AboutDlg::AboutDlg(QWidget *parent, const QString &ver1,
const QString &ver2): QDialog(parent)
{
- ui.setupUi(this);
- QTextDocument *doc = ui.textEdit->document();
- ui.textEdit->setReadOnly(true);
+ ui_.setupUi(this);
+ QTextDocument *doc = ui_.textEdit->document();
+ ui_.textEdit->setReadOnly(true);
QString tt = doc->toHtml();
tt.replace(QRegExp("\\$appname\\$"), QString(appName));
tt.replace(QRegExp("\\$babelversion\\$"), ver1);
doc->setHtml(tt);
QTextCursor cur(doc);
cur.setPosition(0);
- ui.textEdit->setTextCursor(cur);
- ui.textEdit->ensureCursorVisible();
+ ui_.textEdit->setTextCursor(cur);
+ ui_.textEdit->ensureCursorVisible();
}
const QString &ver2);
private:
- Ui_AboutDlg ui;
+ Ui_AboutDlg ui_;
};
bool &previewGmap,
int &debugLevel):
QDialog(parent),
- synthShortNames(synthShortNames),
- enableCharSetXform(enableCharSetXform),
- previewGmap(previewGmap),
- debugLevel(debugLevel)
+ synthShortNames_(synthShortNames),
+ enableCharSetXform_(enableCharSetXform),
+ previewGmap_(previewGmap),
+ debugLevel_(debugLevel)
{
- ui.setupUi(this);
- ui.synthShortNames->setChecked(synthShortNames);
- ui.enableCharSetXform->setChecked(enableCharSetXform);
- ui.previewGmap->setChecked(previewGmap);
- ui.debugCombo->setCurrentIndex(debugLevel+1);
- ui.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
- ui.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
- connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
- connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
+ ui_.setupUi(this);
+ ui_.synthShortNames->setChecked(synthShortNames);
+ ui_.enableCharSetXform->setChecked(enableCharSetXform);
+ ui_.previewGmap->setChecked(previewGmap);
+ ui_.debugCombo->setCurrentIndex(debugLevel+1);
+ ui_.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
+ ui_.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
+ connect(ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
+ connect(ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
}
void AdvDlg::acceptClicked()
{
- synthShortNames = ui.synthShortNames->isChecked();
- enableCharSetXform = ui.enableCharSetXform->isChecked();
- previewGmap = ui.previewGmap->isChecked();
- debugLevel = ui.debugCombo->currentIndex()-1;
+ synthShortNames_ = ui_.synthShortNames->isChecked();
+ enableCharSetXform_ = ui_.enableCharSetXform->isChecked();
+ previewGmap_ = ui_.previewGmap->isChecked();
+ debugLevel_ = ui_.debugCombo->currentIndex()-1;
accept();
}
public:
AdvDlg(QWidget* parent,
- bool &synthShortNames,
- bool &enableCharSetXform,
- bool &previewGmap,
- int &debugLevel);
- QPushButton* formatButton() { return ui.formatButton; };
+ bool &synthShortNames_,
+ bool &enableCharSetXform_,
+ bool &previewGmap_,
+ int &debugLevel_);
+ QPushButton* formatButton() { return ui_.formatButton; };
private:
- Ui_AdvUi ui;
- bool &synthShortNames;
- bool &enableCharSetXform;
- bool &previewGmap;
- int &debugLevel;
+ Ui_AdvUi ui_;
+ bool &synthShortNames_;
+ bool &enableCharSetXform_;
+ bool &previewGmap_;
+ int &debugLevel_;
protected:
class BabelData {
public:
BabelData():
- inputType(fileType),
- inputFileFormat(QString()),
- inputDeviceFormat(QString()),
- inputFileNames(QStringList()),
- inputDeviceName(QString()),
- inputCharSet(QString()),
- xlateWayPts(true),
- xlateRoutes(true),
- xlateTracks(true),
- outputType(fileType),
- outputFileFormat(QString()),
- outputDeviceFormat(QString()),
- outputFileName(QString()),
- outputDeviceName(QString()),
- outputCharSet(QString()),
- synthShortNames(false),
- forceGPSTypes(false),
- enableCharSetXform(false),
- debugLevel(-1),
- inputBrowse(QString()),
- outputBrowse(QString()),
- previewGmap(false),
- upgradeCheckMethod(0),
- upgradeCheckTime(QDateTime(QDate(2001, 1, 1), QTime(0, 0))),
- installationUuid(QUuid::createUuid().toString()),
- upgradeCallbacks(0),
- upgradeAccept(0),
- upgradeDeclines(0),
- upgradeErrors(0),
- upgradeOffers(0),
- runCount(0),
- startupVersionCheck(true),
- reportStatistics(true),
- allowBetaUpgrades(false),
- ignoreVersionMismatch(false),
- disableDonateDialog(false),
- donateSplashed(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0)))
+ inputType_(fileType_),
+ inputFileFormat_(QString()),
+ inputDeviceFormat_(QString()),
+ inputFileNames_(QStringList()),
+ inputDeviceName_(QString()),
+ inputCharSet_(QString()),
+ xlateWayPts_(true),
+ xlateRoutes_(true),
+ xlateTracks_(true),
+ outputType_(fileType_),
+ outputFileFormat_(QString()),
+ outputDeviceFormat_(QString()),
+ outputFileName_(QString()),
+ outputDeviceName_(QString()),
+ outputCharSet_(QString()),
+ synthShortNames_(false),
+ forceGPSTypes_(false),
+ enableCharSetXform_(false),
+ debugLevel_(-1),
+ inputBrowse_(QString()),
+ outputBrowse_(QString()),
+ previewGmap_(false),
+ upgradeCheckMethod_(0),
+ upgradeCheckTime_(QDateTime(QDate(2001, 1, 1), QTime(0, 0))),
+ installationUuid_(QUuid::createUuid().toString()),
+ upgradeCallbacks_(0),
+ upgradeAccept_(0),
+ upgradeDeclines_(0),
+ upgradeErrors_(0),
+ upgradeOffers_(0),
+ runCount_(0),
+ startupVersionCheck_(true),
+ reportStatistics_(true),
+ allowBetaUpgrades_(false),
+ ignoreVersionMismatch_(false),
+ disableDonateDialog_(false),
+ donateSplashed_(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0)))
{
};
}
void makeSettingGroup(SettingGroup &sg) {
- sg.addVarSetting(new IntSetting("app.inputType", inputType));
- sg.addVarSetting(new StringSetting("app.inputFileFormat", inputFileFormat));
- sg.addVarSetting(new StringSetting("app.inputDeviceFormat", inputDeviceFormat));
- sg.addVarSetting(new StringSetting("app.inputCharSet", inputCharSet));
- sg.addVarSetting(new StringSetting("app.inputDeviceName", inputDeviceName));
-
- sg.addVarSetting(new BoolSetting("app.xlateWayPts", xlateWayPts));
- sg.addVarSetting(new BoolSetting("app.xlateRoutes", xlateRoutes));
- sg.addVarSetting(new BoolSetting("app.xlateTracks", xlateTracks));
-
- sg.addVarSetting(new IntSetting("app.outputType", outputType));
- sg.addVarSetting(new StringSetting("app.outputFileFormat", outputFileFormat));
- sg.addVarSetting(new StringSetting("app.outputDeviceFormat", outputDeviceFormat));
- sg.addVarSetting(new StringSetting("app.outputCharSet", outputCharSet));
- sg.addVarSetting(new StringSetting("app.outputDeviceName", outputDeviceName));
-
- sg.addVarSetting(new BoolSetting("app.synthShortNames", synthShortNames));
- sg.addVarSetting(new BoolSetting("app.forceGPSTypes", forceGPSTypes));
- sg.addVarSetting(new BoolSetting("app.enableCharSetXform", enableCharSetXform));
-
- sg.addVarSetting(new StringSetting("app.inputBrowse", inputBrowse));
- sg.addVarSetting(new StringSetting("app.outputBrowse", outputBrowse));
-
- sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap));
- sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckMethod));
- sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeCheckTime));
- sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplashed));
- sg.addVarSetting(new StringSetting("app.installationUuid", installationUuid));
- sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallbacks));
- sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept));
- sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines));
- sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors));
- sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers));
- sg.addVarSetting(new IntSetting("app.runCount", runCount));
+ sg.addVarSetting(new IntSetting("app.inputType", inputType_));
+ sg.addVarSetting(new StringSetting("app.inputFileFormat", inputFileFormat_));
+ sg.addVarSetting(new StringSetting("app.inputDeviceFormat", inputDeviceFormat_));
+ sg.addVarSetting(new StringSetting("app.inputCharSet", inputCharSet_));
+ sg.addVarSetting(new StringSetting("app.inputDeviceName", inputDeviceName_));
+
+ sg.addVarSetting(new BoolSetting("app.xlateWayPts", xlateWayPts_));
+ sg.addVarSetting(new BoolSetting("app.xlateRoutes", xlateRoutes_));
+ sg.addVarSetting(new BoolSetting("app.xlateTracks", xlateTracks_));
+
+ sg.addVarSetting(new IntSetting("app.outputType", outputType_));
+ sg.addVarSetting(new StringSetting("app.outputFileFormat", outputFileFormat_));
+ sg.addVarSetting(new StringSetting("app.outputDeviceFormat", outputDeviceFormat_));
+ sg.addVarSetting(new StringSetting("app.outputCharSet", outputCharSet_));
+ sg.addVarSetting(new StringSetting("app.outputDeviceName", outputDeviceName_));
+
+ sg.addVarSetting(new BoolSetting("app.synthShortNames", synthShortNames_));
+ sg.addVarSetting(new BoolSetting("app.forceGPSTypes", forceGPSTypes_));
+ sg.addVarSetting(new BoolSetting("app.enableCharSetXform", enableCharSetXform_));
+
+ sg.addVarSetting(new StringSetting("app.inputBrowse", inputBrowse_));
+ sg.addVarSetting(new StringSetting("app.outputBrowse", outputBrowse_));
+
+ sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap_));
+ sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckMethod_));
+ sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeCheckTime_));
+ sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplashed_));
+ sg.addVarSetting(new StringSetting("app.installationUuid", installationUuid_));
+ sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallbacks_));
+ sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept_));
+ sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines_));
+ sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors_));
+ sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers_));
+ sg.addVarSetting(new IntSetting("app.runCount", runCount_));
// Global preferences.
- sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVersionCheck));
- sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatistics));
- sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgrades));
- sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVersionMismatch));
- sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDonateDialog));
+ sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVersionCheck_));
+ sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatistics_));
+ sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgrades_));
+ sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVersionMismatch_));
+ sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDonateDialog_));
}
- static const int noType;
- static const int fileType;
- static const int deviceType;
+ static const int noType_;
+ static const int fileType_;
+ static const int deviceType_;
- int inputType;
- QString inputFileFormat;
- QString inputDeviceFormat;
- QStringList inputFileNames;
- QString inputDeviceName;
- QString inputCharSet;
+ int inputType_;
+ QString inputFileFormat_;
+ QString inputDeviceFormat_;
+ QStringList inputFileNames_;
+ QString inputDeviceName_;
+ QString inputCharSet_;
- bool xlateWayPts;
- bool xlateRoutes;
- bool xlateTracks;
+ bool xlateWayPts_;
+ bool xlateRoutes_;
+ bool xlateTracks_;
- int outputType;
- QString outputFileFormat;
- QString outputDeviceFormat;
- QString outputFileName;
- QString outputDeviceName;
- QString outputCharSet;
-
- bool synthShortNames;
- bool forceGPSTypes;
- bool enableCharSetXform;
- int debugLevel;
-
- QString inputBrowse, outputBrowse;
-
- bool previewGmap;
- int upgradeCheckMethod;
- QDateTime upgradeCheckTime;
- QString installationUuid;
- int upgradeCallbacks;
- int upgradeAccept;
- int upgradeDeclines;
- int upgradeErrors;
- int upgradeOffers;
- int runCount;
+ int outputType_;
+ QString outputFileFormat_;
+ QString outputDeviceFormat_;
+ QString outputFileName_;
+ QString outputDeviceName_;
+ QString outputCharSet_;
+
+ bool synthShortNames_;
+ bool forceGPSTypes_;
+ bool enableCharSetXform_;
+ int debugLevel_;
+
+ QString inputBrowse_, outputBrowse_;
+
+ bool previewGmap_;
+ int upgradeCheckMethod_;
+ QDateTime upgradeCheckTime_;
+ QString installationUuid_;
+ int upgradeCallbacks_;
+ int upgradeAccept_;
+ int upgradeDeclines_;
+ int upgradeErrors_;
+ int upgradeOffers_;
+ int runCount_;
// Global preferences.
- bool startupVersionCheck;
- bool reportStatistics;
- bool allowBetaUpgrades;
- bool ignoreVersionMismatch;
- bool disableDonateDialog;
- QDateTime donateSplashed;
+ bool startupVersionCheck_;
+ bool reportStatistics_;
+ bool allowBetaUpgrades_;
+ bool ignoreVersionMismatch_;
+ bool disableDonateDialog_;
+ QDateTime donateSplashed_;
};
// A completely simple QDialog, in a class of its own for layout.
Donate::Donate(QWidget *parent) : QDialog(parent)
{
- ui.setupUi(this);
- connect(ui.contributeButton, SIGNAL(clicked()), this, SLOT(contributeClicked()));
+ ui_.setupUi(this);
+ connect(ui_.contributeButton, SIGNAL(clicked()), this, SLOT(contributeClicked()));
}
void Donate::contributeClicked()
public:
Donate(QWidget *parent);
void showNever(bool f) {
- ui.neverAgain->setVisible(f);
- ui.textLine2->setVisible(f);
+ ui_.neverAgain->setVisible(f);
+ ui_.textLine2->setVisible(f);
}
- bool neverAgain() { return ui.neverAgain->isChecked(); }
+ bool neverAgain() { return ui_.neverAgain->isChecked(); }
private:
- Ui_Donate ui;
+ Ui_Donate ui_;
private slots:
void contributeClicked();
QStringList WayPtsFilterData::makeOptionString()
{
QStringList args;
- if (!inUse)
+ if (!inUse_)
return args;
if (radius) {
{
static const char *fixStrings[] = {"none", "pps", "dgpss", "3d", "2d"}; // match with designer!
QStringList args;
- if (!inUse)
+ if (!inUse_)
return args;
QString s;
QStringList RtTrkFilterData::makeOptionString()
{
QStringList args;
- if (!inUse)
+ if (!inUse_)
return args;
- if (reverse) args << QString("-x") << QString("reverse");
- if (simplify) args << QString("-x") << QString("simplify,count=%1").arg(limitTo);
+ if (reverse_) args << QString("-x") << QString("reverse");
+ if (simplify_) args << QString("-x") << QString("simplify,count=%1").arg(limitTo_);
return args;
}
QStringList MiscFltFilterData::makeOptionString()
{
QStringList args;
- if (!inUse)
+ if (!inUse_)
return args;
- if (nukeRoutes || nukeTracks || nukeWaypoints) {
+ if (nukeRoutes_ || nukeTracks_ || nukeWaypoints_) {
args << QString("-x");
QString s = "nuketypes";
- if (nukeRoutes) s += ",routes";
- if (nukeTracks) s += ",tracks";
- if (nukeWaypoints) s += ",waypoints";
+ if (nukeRoutes_) s += ",routes";
+ if (nukeTracks_) s += ",tracks";
+ if (nukeWaypoints_) s += ",waypoints";
args << s;
}
- if (swap) args << "-x" << "swap";
+ if (swap_) args << "-x" << "swap";
- if (transform) {
+ if (transform_) {
static const char *xformStr[] = {
"wpt=trk",
"trk=rte",
"trk=wpt",
};
args << QString("-x");
- QString s= QString("transform,%1").arg(xformStr[transformVal]);
- if (del) s += ",del";
+ QString s= QString("transform,%1").arg(xformStr[transformVal_]);
+ if (del_) s += ",del";
args << s;
}
return args;
class FilterData {
public:
- FilterData(): inUse(true) {};
+ FilterData(): inUse_(true) {};
virtual ~FilterData() {};
void saveSettings(QSettings &st) {
virtual QStringList makeOptionString() = 0;
public:
- bool inUse;
+ bool inUse_;
};
//------------------------------------------------------------------------
}
virtual void makeSettingGroup(SettingGroup &sg)
{
- sg.addVarSetting(new BoolSetting("trks.inUse", inUse));
+ sg.addVarSetting(new BoolSetting("trks.inUse", inUse_));
sg.addVarSetting(new BoolSetting("trks.GPSFixes", GPSFixes));
sg.addVarSetting(new IntSetting("trks.GPSFixesVal", GPSFixesVal));
sg.addVarSetting(new BoolSetting("trks.course", course));
virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg)
{
- sg.addVarSetting(new BoolSetting("wpts.inUse", inUse));
+ sg.addVarSetting(new BoolSetting("wpts.inUse", inUse_));
sg.addVarSetting(new BoolSetting("wpts.radius", radius));
sg.addVarSetting(new DoubleSetting("wpts.radiusVal", radiusVal));
sg.addVarSetting(new IntSetting("wpts.radiusUnit", radiusUnit));
class RtTrkFilterData: public FilterData {
public:
RtTrkFilterData(): FilterData(),
- simplify(false),
- reverse(false),
- limitTo(100)
+ simplify_(false),
+ reverse_(false),
+ limitTo_(100)
{
}
virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg) {
- sg.addVarSetting(new BoolSetting("rttrk.inUse", inUse));
- sg.addVarSetting(new BoolSetting("rttrk.reverse", reverse));
- sg.addVarSetting(new BoolSetting("rttrk.simplify", simplify));
- sg.addVarSetting(new IntSetting("rttrk.limitTo", limitTo));
+ sg.addVarSetting(new BoolSetting("rttrk.inUse", inUse_));
+ sg.addVarSetting(new BoolSetting("rttrk.reverse", reverse_));
+ sg.addVarSetting(new BoolSetting("rttrk.simplify", simplify_));
+ sg.addVarSetting(new IntSetting("rttrk.limitTo", limitTo_));
}
public:
- bool simplify, reverse;
- int limitTo;
+ bool simplify_, reverse_;
+ int limitTo_;
};
//------------------------------------------------------------------------
class MiscFltFilterData: public FilterData {
public:
MiscFltFilterData(): FilterData(),
- nukeRoutes(false),
- nukeTracks(false),
- nukeWaypoints(false),
- transform(false),
- del(false),
- swap(false),
- transformVal(0)
+ nukeRoutes_(false),
+ nukeTracks_(false),
+ nukeWaypoints_(false),
+ transform_(false),
+ del_(false),
+ swap_(false),
+ transformVal_(0)
{
}
virtual QStringList makeOptionString();
virtual void makeSettingGroup(SettingGroup &sg)
{
- sg.addVarSetting(new BoolSetting("mscflt.nukeRoutes", nukeRoutes));
- sg.addVarSetting(new BoolSetting("mscflt.nukeTracks", nukeTracks));
- sg.addVarSetting(new BoolSetting("mscflt.nukeWaypoints", nukeWaypoints));
- sg.addVarSetting(new BoolSetting("mscflt.inUse", inUse));
- sg.addVarSetting(new BoolSetting("mscflt.transform", transform));
- sg.addVarSetting(new IntSetting("mscflt.transformVal", transformVal));
- sg.addVarSetting(new BoolSetting("mscflt.delete", del));
- sg.addVarSetting(new BoolSetting("mscflt.swap", swap));
+ sg.addVarSetting(new BoolSetting("mscflt.nukeRoutes", nukeRoutes_));
+ sg.addVarSetting(new BoolSetting("mscflt.nukeTracks", nukeTracks_));
+ sg.addVarSetting(new BoolSetting("mscflt.nukeWaypoints", nukeWaypoints_));
+ sg.addVarSetting(new BoolSetting("mscflt.inUse", inUse_));
+ sg.addVarSetting(new BoolSetting("mscflt.transform", transform_));
+ sg.addVarSetting(new IntSetting("mscflt.transformVal", transformVal_));
+ sg.addVarSetting(new BoolSetting("mscflt.delete", del_));
+ sg.addVarSetting(new BoolSetting("mscflt.swap", swap_));
}
public:
- bool nukeRoutes, nukeTracks, nukeWaypoints;
- bool transform, del, swap;
- int transformVal;
+ bool nukeRoutes_, nukeTracks_, nukeWaypoints_;
+ bool transform_, del_, swap_;
+ int transformVal_;
};
#include "help.h"
#include "appname.h"
-int FilterDialog::lastPage = 0;
+int FilterDialog::lastPage_ = 0;
-FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent), fd(fd)
+FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent), fd_(fd)
{
- ui.setupUi(this);
- ui.filterList->clear();
+ ui_.setupUi(this);
+ ui_.filterList->clear();
- widgetStack = new QStackedWidget(ui.frame);
- QHBoxLayout *layout = new QHBoxLayout(ui.frame);
- layout->addWidget(widgetStack);
+ widgetStack_ = new QStackedWidget(ui_.frame);
+ QHBoxLayout *layout = new QHBoxLayout(ui_.frame);
+ layout->addWidget(widgetStack_);
layout->setContentsMargins(2, 2, 2, 2);
addFilterPage(tr("Tracks"),
- new TrackWidget(widgetStack, fd.trackFilterData), &fd.trackFilterData.inUse);
+ new TrackWidget(widgetStack_, fd.trackFilterData), &fd.trackFilterData.inUse_);
addFilterPage(tr("Waypoints"),
- new WayPtsWidget(widgetStack, fd.wayPtsFilterData), &fd.wayPtsFilterData.inUse);
+ new WayPtsWidget(widgetStack_, fd.wayPtsFilterData), &fd.wayPtsFilterData.inUse_);
addFilterPage(tr("Routes & Tracks"),
- new RtTrkWidget(widgetStack, fd.rtTrkFilterData), &fd.rtTrkFilterData.inUse);
+ new RtTrkWidget(widgetStack_, fd.rtTrkFilterData), &fd.rtTrkFilterData.inUse_);
addFilterPage(tr("Miscellaneous"),
- new MiscFltWidget(widgetStack, fd.miscFltFilterData), &fd.miscFltFilterData.inUse);
+ new MiscFltWidget(widgetStack_, fd.miscFltFilterData), &fd.miscFltFilterData.inUse_);
- connect(ui.filterList, SIGNAL(currentRowChanged(int)),
+ connect(ui_.filterList, SIGNAL(currentRowChanged(int)),
this, SLOT(pageSelectionChanged(int)));
- connect(ui.filterList, SIGNAL(itemClicked(QListWidgetItem *)),
+ connect(ui_.filterList, SIGNAL(itemClicked(QListWidgetItem *)),
this, SLOT(itemClickedX(QListWidgetItem*)));
- connect(ui.helpButton, SIGNAL(clicked()), this, SLOT(helpX()));
- connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetX()));
+ connect(ui_.helpButton, SIGNAL(clicked()), this, SLOT(helpX()));
+ connect(ui_.resetButton, SIGNAL(clicked()), this, SLOT(resetX()));
- ui.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
- ui.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
+ ui_.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
+ ui_.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
- ui.filterList->setCurrentRow(lastPage);
+ ui_.filterList->setCurrentRow(lastPage_);
// So that it occupies minimum space.
this->resize(100, 100);
QListWidgetItem *it = new QListWidgetItem(name);
it->setCheckState(*use? Qt::Checked:Qt::Unchecked);
fw->setEnabled(*use);
- ui.filterList->addItem(it);
- widgetStack->addWidget(fw);
- pages << fw;
- usePages << use;
+ ui_.filterList->addItem(it);
+ widgetStack_->addWidget(fw);
+ pages_ << fw;
+ usePages_ << use;
}
//------------------------------------------------------------------------
void FilterDialog::itemClickedX(QListWidgetItem *it)
{
- int row = ui.filterList->row(it);
+ int row = ui_.filterList->row(it);
bool b = (it->checkState() == Qt::Checked);
- pages[row]->setEnabled(b);
- pages[row]->checkChecks();
+ pages_[row]->setEnabled(b);
+ pages_[row]->checkChecks();
}
//------------------------------------------------------------------------
void FilterDialog::pageSelectionChanged(int i)
{
- widgetStack->setCurrentWidget(pages[i]);
+ widgetStack_->setCurrentWidget(pages_[i]);
}
//------------------------------------------------------------------------
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
- fd.defaultAll();
- for (int i=0; i<pages.size(); i++) {
- pages[i]->setWidgetValues();
- pages[i]->setEnabled(*(usePages[i]));
- pages[i]->checkChecks();
- ui.filterList->item(i)->setCheckState(*(usePages[i]) ? Qt::Checked: Qt::Unchecked);
+ fd_.defaultAll();
+ for (int i=0; i<pages_.size(); i++) {
+ pages_[i]->setWidgetValues();
+ pages_[i]->setEnabled(*(usePages_[i]));
+ pages_[i]->checkChecks();
+ ui_.filterList->item(i)->setCheckState(*(usePages_[i]) ? Qt::Checked: Qt::Unchecked);
}
}
}
void FilterDialog::runDialog()
{
if (exec()) {
- for (int i=0; i<pages.size(); i++) {
- pages[i]->getWidgetValues();
- *(usePages[i]) = ui.filterList->item(i)->checkState() == Qt::Checked;
+ for (int i=0; i<pages_.size(); i++) {
+ pages_[i]->getWidgetValues();
+ *(usePages_[i]) = ui_.filterList->item(i)->checkState() == Qt::Checked;
}
}
- lastPage = ui.filterList->currentRow();
+ lastPage_ = ui_.filterList->currentRow();
}
{
Q_OBJECT
public:
- FilterDialog(QWidget *parent, AllFiltersData &fd);
+ FilterDialog(QWidget *parent, AllFiltersData &fd_);
~FilterDialog() {}
void runDialog();
private:
- static int lastPage;
- QList <FilterWidget *>pages;
- QList <bool *>usePages;
- QStackedWidget *widgetStack;
- Ui_FilterDlg ui;
- AllFiltersData &fd;
+ static int lastPage_;
+ QList <FilterWidget *>pages_;
+ QList <bool *>usePages_;
+ QStackedWidget *widgetStack_;
+ Ui_FilterDlg ui_;
+ AllFiltersData &fd_;
void addFilterPage(const QString & name, FilterWidget *w, bool *);
addCheckEnabler(ui.simplifyCheck,
QList<QWidget*>() << ui.limitToLabel << ui.limitToSpin << ui.pointLabel);
- fopts << new BoolFilterOption(rfd.simplify, ui.simplifyCheck);
- fopts << new BoolFilterOption(rfd.reverse, ui.reverseCheck);
- fopts << new IntSpinFilterOption(rfd.limitTo, ui.limitToSpin, 1, 5000);
+ fopts << new BoolFilterOption(rfd.simplify_, ui.simplifyCheck);
+ fopts << new BoolFilterOption(rfd.reverse_, ui.reverseCheck);
+ fopts << new IntSpinFilterOption(rfd.limitTo_, ui.limitToSpin, 1, 5000);
setWidgetValues();
checkChecks();
}
addCheckEnabler(ui.transformCheck,
QList<QWidget*>() << ui.transformCombo << ui.deleteCheck);
- fopts << new BoolFilterOption(mfd.transform, ui.transformCheck);
- fopts << new BoolFilterOption(mfd.swap, ui.swapCheck);
- fopts << new BoolFilterOption(mfd.del, ui.deleteCheck);
- fopts << new BoolFilterOption(mfd.nukeTracks, ui.nukeTracks);
- fopts << new BoolFilterOption(mfd.nukeRoutes, ui.nukeRoutes);
- fopts << new BoolFilterOption(mfd.nukeWaypoints, ui.nukeWaypoints);
- fopts << new ComboFilterOption(mfd.transformVal, ui.transformCombo);
+ fopts << new BoolFilterOption(mfd.transform_, ui.transformCheck);
+ fopts << new BoolFilterOption(mfd.swap_, ui.swapCheck);
+ fopts << new BoolFilterOption(mfd.del_, ui.deleteCheck);
+ fopts << new BoolFilterOption(mfd.nukeTracks_, ui.nukeTracks);
+ fopts << new BoolFilterOption(mfd.nukeRoutes_, ui.nukeRoutes);
+ fopts << new BoolFilterOption(mfd.nukeWaypoints_, ui.nukeWaypoints);
+ fopts << new ComboFilterOption(mfd.transformVal_, ui.transformCombo);
setWidgetValues();
checkChecks();
#include "format.h"
#include "mainwindow.h"
-QString Format::htmlBase = QString();
+QString Format::htmlBase_ = QString();
static void saveOptions(QSettings &settings, const QString &prefix, const QList<FormatOption> &options) {
for (int i=0; i<options.size(); i++) {
void Format::saveSettings(QSettings &settings)
{
- saveOptions(settings, name+".input", inputOptions);
- saveOptions(settings, name+".output", outputOptions);
- settings.setValue(name + ".readcount", getReadUseCount());
- settings.setValue(name + ".writecount", getWriteUseCount());
- settings.setValue(name+".hidden", isHidden());
+ saveOptions(settings, name_+".input", inputOptions_);
+ saveOptions(settings, name_+".output", outputOptions_);
+ settings.setValue(name_ + ".readcount", getReadUseCount());
+ settings.setValue(name_ + ".writecount", getWriteUseCount());
+ settings.setValue(name_+".hidden", isHidden());
}
void Format::restoreSettings(QSettings &settings)
{
- restoreOptions(settings, name + ".input", inputOptions);
- restoreOptions(settings, name + ".output", outputOptions);
- bumpReadUseCount(settings.value(name + ".readcount").toInt());
- bumpWriteUseCount(settings.value(name + ".writecount").toInt());
- hidden_ = settings.value(name + ".hidden", false).toBool();
+ restoreOptions(settings, name_ + ".input", inputOptions_);
+ restoreOptions(settings, name_ + ".output", outputOptions_);
+ bumpReadUseCount(settings.value(name_ + ".readcount").toInt());
+ bumpWriteUseCount(settings.value(name_ + ".writecount").toInt());
+ hidden_ = settings.value(name_ + ".hidden", false).toBool();
}
void Format::setToDefault()
{
- for (int i=0; i<inputOptions.size(); i++) {
- inputOptions[i].setSelected(false);
- inputOptions[i].setValue(QVariant());
+ for (int i=0; i<inputOptions_.size(); i++) {
+ inputOptions_[i].setSelected(false);
+ inputOptions_[i].setValue(QVariant());
}
- for (int i=0; i<outputOptions.size(); i++) {
- outputOptions[i].setSelected(false);
- outputOptions[i].setValue(QVariant());
+ for (int i=0; i<outputOptions_.size(); i++) {
+ outputOptions_[i].setSelected(false);
+ outputOptions_[i].setValue(QVariant());
}
}
OPToutFile,
} optionType;
- FormatOption(): name(QString()), description(QString()), type(OPTbool),
- defaultValue(QVariant()),
- minValue(QVariant()), maxValue(QVariant()),
- html(QString()), value(QVariant()), selected(false)
+ FormatOption(): name_(QString()), description_(QString()), type_(OPTbool),
+ defaultValue_(QVariant()),
+ minValue_(QVariant()), maxValue_(QVariant()),
+ html_(QString()), value_(QVariant()), isSelected_(false)
{
}
FormatOption(const QString &name,
QVariant minValue = QVariant(),
QVariant maxValue = QVariant(),
QString html = QString()
- ): name(name), description(description), type(type),
- defaultValue(defaultValue), minValue(minValue), maxValue(maxValue), html(html)
+ ): name_(name), description_(description), type_(type),
+ defaultValue_(defaultValue), minValue_(minValue), maxValue_(maxValue), html_(html)
{
- value = QVariant();
- selected = false;
+ value_ = QVariant();
+ isSelected_ = false;
}
FormatOption(const FormatOption & c)
- : name(c.name), description(c.description), type(c.type),
- defaultValue(c.defaultValue), minValue(c.minValue), maxValue(c.maxValue), html(c.html),
- value(c.value), selected(c.selected)
+ : name_(c.name_), description_(c.description_), type_(c.type_),
+ defaultValue_(c.defaultValue_), minValue_(c.minValue_), maxValue_(c.maxValue_), html_(c.html_),
+ value_(c.value_), isSelected_(c.isSelected_)
{
}
- QString getName() const {return name; }
- QString getDescription() const {return description; }
- optionType getType() const {return type; }
- QVariant getValue() const { return value; }
- bool getSelected() const {return selected; }
- QVariant getMinValue() const {return minValue; }
- QVariant getMaxValue() const {return maxValue; }
- QVariant getDefaultValue() const {return defaultValue; }
-
- void setValue(QVariant v) { value = v; };
- void setSelected(bool v) { selected = v; };
- QString getHtml() const { return html; };
+ QString getName() const {return name_; }
+ QString getDescription() const {return description_; }
+ optionType getType() const {return type_; }
+ QVariant getValue() const { return value_; }
+ bool getSelected() const {return isSelected_; }
+ QVariant getMinValue() const {return minValue_; }
+ QVariant getMaxValue() const {return maxValue_; }
+ QVariant getDefaultValue() const {return defaultValue_; }
+
+ void setValue(QVariant v) { value_ = v; };
+ void setSelected(bool v) { isSelected_ = v; };
+ QString getHtml() const { return html_; };
private:
- QString name;
- QString description;
- optionType type;
- QVariant defaultValue;
- QVariant minValue;
- QVariant maxValue;
- QString html;
- QVariant value;
- bool selected;
+ QString name_;
+ QString description_;
+ optionType type_;
+ QVariant defaultValue_;
+ QVariant minValue_;
+ QVariant maxValue_;
+ QString html_;
+ QVariant value_;
+ bool isSelected_;
};
class Format
{
public:
- Format():name(QString()),
- description(QString()),
- readWaypoints(false),
- readTracks(false),
- readRoutes(false),
- writeWaypoints(false),
- writeTracks(false),
- writeRoutes(false),
- fileFormat(false),
- deviceFormat(false),
+ Format():name_(QString()),
+ description_(QString()),
+ readWaypoints_(false),
+ readTracks_(false),
+ readRoutes_(false),
+ writeWaypoints_(false),
+ writeTracks_(false),
+ writeRoutes_(false),
+ fileFormat_(false),
+ deviceFormat_(false),
hidden_(false),
- extensions(QStringList()),
- html(QString()),
+ extensions_(QStringList()),
+ html_(QString()),
readUseCount_(0),
writeUseCount_(0)
{
- inputOptions.clear();
- outputOptions.clear();
+ inputOptions_.clear();
+ outputOptions_.clear();
};
Format(const QString &name,
QList<FormatOption> &inputOptions,
QList<FormatOption> &outputptions,
const QString &html):
- name(name), description(description),
- readWaypoints(readWaypoints), readTracks(readTracks), readRoutes(readRoutes),
- writeWaypoints(writeWaypoints), writeTracks(writeTracks), writeRoutes(writeRoutes),
- fileFormat(fileFormat), deviceFormat(deviceFormat),
+ name_(name), description_(description),
+ readWaypoints_(readWaypoints), readTracks_(readTracks), readRoutes_(readRoutes),
+ writeWaypoints_(writeWaypoints), writeTracks_(writeTracks), writeRoutes_(writeRoutes),
+ fileFormat_(fileFormat), deviceFormat_(deviceFormat),
hidden_(false),
- extensions(extensions),
- inputOptions(inputOptions),
- outputOptions(outputptions),
- html(QString()),
+ extensions_(extensions),
+ inputOptions_(inputOptions),
+ outputOptions_(outputptions),
+ html_(QString()),
readUseCount_(0),
writeUseCount_(0)
{
}
Format(const Format &c):
- name(c.name), description(c.description),
- readWaypoints(c.readWaypoints), readTracks(c.readTracks), readRoutes(c.readRoutes),
- writeWaypoints(c.writeWaypoints), writeTracks(c.writeTracks), writeRoutes(c.writeRoutes),
- fileFormat(c.fileFormat), deviceFormat(c.deviceFormat),
+ name_(c.name_), description_(c.description_),
+ readWaypoints_(c.readWaypoints_), readTracks_(c.readTracks_), readRoutes_(c.readRoutes_),
+ writeWaypoints_(c.writeWaypoints_), writeTracks_(c.writeTracks_), writeRoutes_(c.writeRoutes_),
+ fileFormat_(c.fileFormat_), deviceFormat_(c.deviceFormat_),
hidden_(false),
- extensions(c.extensions),
- inputOptions(c.inputOptions),
- outputOptions(c.outputOptions),
- html(c.html),
+ extensions_(c.extensions_),
+ inputOptions_(c.inputOptions_),
+ outputOptions_(c.outputOptions_),
+ html_(c.html_),
readUseCount_(0),
writeUseCount_(0)
{
~Format() {};
- bool isReadWaypoints() const { return readWaypoints; };
- bool isReadTracks() const { return readTracks; };
- bool isReadRoutes() const { return readRoutes; };
+ bool isReadWaypoints() const { return readWaypoints_; };
+ bool isReadTracks() const { return readTracks_; };
+ bool isReadRoutes() const { return readRoutes_; };
bool isReadSomething() const {
return isReadWaypoints() || isReadTracks () || isReadRoutes();
};
- bool isWriteWaypoints() const { return writeWaypoints; };
- bool isWriteTracks() const { return writeTracks; };
- bool isWriteRoutes() const { return writeRoutes; };
+ bool isWriteWaypoints() const { return writeWaypoints_; };
+ bool isWriteTracks() const { return writeTracks_; };
+ bool isWriteRoutes() const { return writeRoutes_; };
bool isWriteSomething() const {
return isWriteWaypoints() || isWriteTracks () || isWriteRoutes();
};
- QString getName() const { return name; };
- QString getDescription() const { return description; };
- QString getHtml() const { return html; };
- QStringList getExtensions() const { return extensions; };
- const QList<FormatOption> &getInputOptions() const { return inputOptions; };
- const QList<FormatOption> &getOutputOptions() const { return outputOptions; };
+ QString getName() const { return name_; };
+ QString getDescription() const { return description_; };
+ QString getHtml() const { return html_; };
+ QStringList getExtensions() const { return extensions_; };
+ const QList<FormatOption> &getInputOptions() const { return inputOptions_; };
+ const QList<FormatOption> &getOutputOptions() const { return outputOptions_; };
- QList<FormatOption> *getInputOptionsRef() { return &inputOptions; };
- QList<FormatOption> *getOutputOptionsRef() { return &outputOptions; };
+ QList<FormatOption> *getInputOptionsRef() { return &inputOptions_; };
+ QList<FormatOption> *getOutputOptionsRef() { return &outputOptions_; };
- bool isDeviceFormat() const { return deviceFormat; };
- bool isFileFormat() const { return fileFormat; };
+ bool isDeviceFormat() const { return deviceFormat_; };
+ bool isFileFormat() const { return fileFormat_; };
bool isHidden() const { return hidden_; };
void setHidden(bool state) { hidden_ = state; };
void saveSettings(QSettings &settings);
void restoreSettings(QSettings &settings);
void setToDefault();
- static QString getHtmlBase() { return htmlBase; }
- static void setHtmlBase(const QString &s) { htmlBase = s; }
+ static QString getHtmlBase() { return htmlBase_; }
+ static void setHtmlBase(const QString &s) { htmlBase_ = s; }
void bumpReadUseCount(int v) { readUseCount_ += v; }
void bumpWriteUseCount(int v) { writeUseCount_ += v; }
int getReadUseCount() const { return readUseCount_; }
int getWriteUseCount() const { return writeUseCount_; }
void zeroUseCounts(void) {
- readUseCount_ = 0;
- writeUseCount_= 0;
+ readUseCount_ = 0;
+ writeUseCount_ = 0;
}
private:
- QString name, description;
- bool readWaypoints, readTracks, readRoutes;
- bool writeWaypoints, writeTracks, writeRoutes;
- bool fileFormat, deviceFormat, hidden_;
- QStringList extensions;
- QList<FormatOption>inputOptions;
- QList<FormatOption>outputOptions;
- QString html;
- static QString htmlBase;
+ QString name_, description_;
+ bool readWaypoints_, readTracks_, readRoutes_;
+ bool writeWaypoints_, writeTracks_, writeRoutes_;
+ bool fileFormat_, deviceFormat_, hidden_;
+ QStringList extensions_;
+ QList<FormatOption>inputOptions_;
+ QList<FormatOption>outputOptions_;
+ QString html_;
+ static QString htmlBase_;
int readUseCount_;
int writeUseCount_;
bool FormatLoad::skipToValidLine()
{
QRegExp regex("^(file|serial)");
- while (currentLine <lines.size() && regex.indexIn(lines[currentLine]) != 0)
- currentLine++;
- return (currentLine<lines.size());
+ while (currentLine_ <lines_.size() && regex.indexIn(lines_[currentLine_]) != 0)
+ currentLine_++;
+ return (currentLine_<lines_.size());
}
//------------------------------------------------------------------------
bool FormatLoad::processFormat(Format &format)
{
- QStringList hfields = lines[currentLine++].split("\t");
+ QStringList hfields = lines_[currentLine_++].split("\t");
if (hfields.size() < 5) {
return false;
}
- QString htmlPage = lines[currentLine++];
+ QString htmlPage = lines_[currentLine_++];
htmlPage.replace(QRegExp("^[\\s]*"), "");
htmlPage.replace(QRegExp("[\\s]$"), "");
QRegExp regex("^option");
QList <FormatOption> optionList;
- while (currentLine <lines.size() && regex.indexIn(lines[currentLine]) == 0) {
- QStringList ofields = lines[currentLine].split("\t");
+ while (currentLine_ <lines_.size() && regex.indexIn(lines_[currentLine_]) == 0) {
+ QStringList ofields = lines_[currentLine_].split("\t");
if (ofields.size() < 9) {
return false;
}
optionList << FormatOption(name, xlt(description),
type, QVariant(optionDef), QVariant(optionMin),
QVariant(optionMax), optionHtml);
- currentLine++;
+ currentLine_++;
}
QList <FormatOption> optionList2 = optionList;
QString l = tstream.readLine();
k++;
if (!QRegExp("^[\\s]*$").exactMatch(l)) {
- lines << l;
+ lines_ << l;
lineList<<k;
}
}
- currentLine = 0;
+ currentLine_ = 0;
for (bool dataPresent = skipToValidLine(); dataPresent; dataPresent=skipToValidLine()) {
Format format;
if (!processFormat(format)) {
QMessageBox::information
(0, appName,
- QObject::tr("Error processing formats from running process \"gpsbabel -^3\" at line %1").arg(lineList[currentLine]));
+ QObject::tr("Error processing formats from running process \"gpsbabel -^3\" at line %1").arg(lineList[currentLine_]));
}
else {
formatList << format;
bool getFormats(QList<Format> &formatList);
private:
- QStringList lines;
- int currentLine;
+ QStringList lines_;
+ int currentLine_;
bool skipToValidLine();
bool processFormat(Format &format);
};
//------------------------------------------------------------------------
GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *te): QDialog(parent)
{
- ui.setupUi(this);
+ ui_.setupUi(this);
this->setWindowTitle(QString(appName) + " " + QString("Google Maps"));
- gpx.read(gpxFileName);
+ gpx_.read(gpxFileName);
- mapWidget = new Map(this, gpx, te);
- QHBoxLayout *lay = new QHBoxLayout(ui.frame);
+ mapWidget_ = new Map(this, gpx_, te);
+ QHBoxLayout *lay = new QHBoxLayout(ui_.frame);
lay->setContentsMargins(0, 0, 0, 0);
- lay->addWidget(mapWidget);
+ lay->addWidget(mapWidget_);
- model = new QStandardItemModel(this);
+ model_ = new QStandardItemModel(this);
- wptItem = new StandardItem(tr("Waypoints"));
- wptItem->setCheckable(true);
- wptItem->setCheckState(Qt::Checked);
- model->appendRow(wptItem);
- for (int i=0; i<gpx.getWaypoints().size(); i++) {
- GpxWaypoint &wpt = gpx.getWaypoints()[i];
+ wptItem_ = new StandardItem(tr("Waypoints"));
+ wptItem_->setCheckable(true);
+ wptItem_->setCheckState(Qt::Checked);
+ model_->appendRow(wptItem_);
+ for (int i=0; i<gpx_.getWaypoints().size(); i++) {
+ GpxWaypoint &wpt = gpx_.getWaypoints()[i];
QStandardItem *it = new StandardItem(wpt.getName());
- wptItem->appendRow(it);
+ wptItem_->appendRow(it);
it->setCheckable(true);
it->setCheckState(Qt::Checked);
it->setData(qVariantFromValue((void *)&wpt));
appendWaypointInfo(it, wpt);
- wptList << it;
+ wptList_ << it;
}
- trkItem = new StandardItem(tr("Tracks"));
- trkItem->setCheckable(true);
- trkItem->setCheckState(Qt::Checked);
- model->appendRow(trkItem);
- for (int i=0; i<gpx.getTracks().size(); i++) {
- GpxTrack &trk = gpx.getTracks()[i];
+ trkItem_ = new StandardItem(tr("Tracks"));
+ trkItem_->setCheckable(true);
+ trkItem_->setCheckState(Qt::Checked);
+ model_->appendRow(trkItem_);
+ for (int i=0; i<gpx_.getTracks().size(); i++) {
+ GpxTrack &trk = gpx_.getTracks()[i];
QStandardItem *it = new StandardItem(trk.getName());
- trkItem->appendRow(it);
+ trkItem_->appendRow(it);
it->setCheckable(true);
it->setCheckState(Qt::Checked);
it->setData(qVariantFromValue((void *)&trk));
appendTrackInfo(it, trk);
- trkList << it;
+ trkList_ << it;
}
- rteItem = new StandardItem(tr("Routes"));
- rteItem->setCheckable(true);
- rteItem->setCheckState(Qt::Checked);
- model->appendRow(rteItem);
- for (int i=0; i<gpx.getRoutes().size(); i++) {
- GpxRoute &rte = gpx.getRoutes()[i];
+ rteItem_ = new StandardItem(tr("Routes"));
+ rteItem_->setCheckable(true);
+ rteItem_->setCheckState(Qt::Checked);
+ model_->appendRow(rteItem_);
+ for (int i=0; i<gpx_.getRoutes().size(); i++) {
+ GpxRoute &rte = gpx_.getRoutes()[i];
QStandardItem *it = new StandardItem(rte.getName());
- rteItem->appendRow(it);
+ rteItem_->appendRow(it);
it->setCheckable(true);
it->setCheckState(Qt::Checked);
it->setData(qVariantFromValue((void *)&rte));
appendRouteInfo(it, rte);
- rteList << it;
+ rteList_ << it;
}
- ui.treeView->header()->hide();
- ui.treeView->setModel(model);
- ui.treeView->setExpandsOnDoubleClick(false);
- connect(model, SIGNAL(itemChanged(QStandardItem *)),
+ ui_.treeView->header()->hide();
+ ui_.treeView->setModel(model_);
+ ui_.treeView->setExpandsOnDoubleClick(false);
+ connect(model_, SIGNAL(itemChanged(QStandardItem *)),
this, SLOT(itemChangedX(QStandardItem *)));
- connect(mapWidget, SIGNAL(waypointClicked(int)), this, SLOT(waypointClickedX(int)));
- connect(mapWidget, SIGNAL(routeClicked(int)), this, SLOT(routeClickedX(int)));
- connect(mapWidget, SIGNAL(trackClicked(int)), this, SLOT(trackClickedX(int)));
- connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex &)),
+ connect(mapWidget_, SIGNAL(waypointClicked(int)), this, SLOT(waypointClickedX(int)));
+ connect(mapWidget_, SIGNAL(routeClicked(int)), this, SLOT(routeClickedX(int)));
+ connect(mapWidget_, SIGNAL(trackClicked(int)), this, SLOT(trackClickedX(int)));
+ connect(ui_.treeView, SIGNAL(doubleClicked(const QModelIndex &)),
this, SLOT(treeDoubleClicked(const QModelIndex&)));
- connect(ui.treeView->selectionModel(), SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)),
+ connect(ui_.treeView->selectionModel(), SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)),
this, SLOT(selectionChangedX(const QItemSelection &, const QItemSelection &)));
- ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(ui.treeView, SIGNAL(customContextMenuRequested(const QPoint &)),
+ ui_.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(ui_.treeView, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showContextMenu(const QPoint &)));
- connect(ui.copyButton, SIGNAL(clicked()), this, SLOT(copyButtonClickedX()));
+ connect(ui_.copyButton, SIGNAL(clicked()), this, SLOT(copyButtonClickedX()));
- ui.copyButton->hide(); // Hide for now, not working
+ ui_.copyButton->hide(); // Hide for now, not working
}
void GMapDialog::itemChangedX(QStandardItem *it)
{
bool show = (it->checkState() == Qt::Checked);
- if (it == trkItem) {
+ if (it == trkItem_) {
if (show)
- mapWidget->showTracks(gpx.getTracks());
+ mapWidget_->showTracks(gpx_.getTracks());
else
- mapWidget->hideAllTracks();
+ mapWidget_->hideAllTracks();
}
- else if (it == wptItem) {
+ else if (it == wptItem_) {
if (show)
- mapWidget->showWaypoints(gpx.getWaypoints());
+ mapWidget_->showWaypoints(gpx_.getWaypoints());
else
- mapWidget->hideAllWaypoints();
+ mapWidget_->hideAllWaypoints();
}
- else if (it == rteItem) {
+ else if (it == rteItem_) {
if (show)
- mapWidget->showRoutes(gpx.getRoutes());
+ mapWidget_->showRoutes(gpx_.getRoutes());
else
- mapWidget->hideAllRoutes();
+ mapWidget_->hideAllRoutes();
}
else {
GpxItem *git = static_cast<GpxItem *>(it->data().value<void *>());
if (git != 0) {
git->setVisible(show);
- for (int i=0; i<gpx.getWaypoints().size(); i++) {
- if (&gpx.getWaypoints()[i] == git) {
- mapWidget->setWaypointVisibility(i, show);
+ for (int i=0; i<gpx_.getWaypoints().size(); i++) {
+ if (&gpx_.getWaypoints()[i] == git) {
+ mapWidget_->setWaypointVisibility(i, show);
}
}
- for (int i=0; i<gpx.getTracks().size(); i++) {
- if (&gpx.getTracks()[i] == git) {
- mapWidget->setTrackVisibility(i, show);
+ for (int i=0; i<gpx_.getTracks().size(); i++) {
+ if (&gpx_.getTracks()[i] == git) {
+ mapWidget_->setTrackVisibility(i, show);
}
}
- for (int i=0; i<gpx.getRoutes().size(); i++) {
- if (&gpx.getRoutes()[i] == git) {
- mapWidget->setRouteVisibility(i, show);
+ for (int i=0; i<gpx_.getRoutes().size(); i++) {
+ if (&gpx_.getRoutes()[i] == git) {
+ mapWidget_->setRouteVisibility(i, show);
}
}
}
//-------------------------------------------------------------------------
int GMapDialog::waypointIndex(QStandardItem *it)
{
- for (int j=0; j<wptList.size(); j++){
- if (it == wptList[j])
+ for (int j=0; j<wptList_.size(); j++){
+ if (it == wptList_[j])
return j;
}
return -1;
//-------------------------------------------------------------------------
int GMapDialog::trackIndex(QStandardItem *it)
{
- for (int j=0; j<trkList.size(); j++){
- if (it == trkList[j])
+ for (int j=0; j<trkList_.size(); j++){
+ if (it == trkList_[j])
return j;
}
return -1;
//-------------------------------------------------------------------------
int GMapDialog::routeIndex(QStandardItem *it)
{
- for (int j=0; j<rteList.size(); j++){
- if (it == rteList[j])
+ for (int j=0; j<rteList_.size(); j++){
+ if (it == rteList_[j])
return j;
}
return -1;
//-------------------------------------------------------------------------
void GMapDialog::treeDoubleClicked(const QModelIndex &idx)
{
- QStandardItem *it = model->itemFromIndex(idx);
+ QStandardItem *it = model_->itemFromIndex(idx);
int i = waypointIndex(it);
if (i >= 0) {
it->setCheckState(Qt::Checked);
- gpx.getWaypoints()[i].setVisible(true);
- mapWidget->panTo(gpx.getWaypoints()[i].getLocation());
- mapWidget->setWaypointVisibility(i, true);
+ gpx_.getWaypoints()[i].setVisible(true);
+ mapWidget_->panTo(gpx_.getWaypoints()[i].getLocation());
+ mapWidget_->setWaypointVisibility(i, true);
return;
}
i = trackIndex(it);
if (i >= 0) {
- mapWidget->frameTrack(i);
+ mapWidget_->frameTrack(i);
it->setCheckState(Qt::Checked);
- gpx.getTracks()[i].setVisible(true);
- mapWidget->setTrackVisibility(i, true);
+ gpx_.getTracks()[i].setVisible(true);
+ mapWidget_->setTrackVisibility(i, true);
return;
}
i = routeIndex(it);
if (i >= 0) {
- mapWidget->frameRoute(i);
+ mapWidget_->frameRoute(i);
it->setCheckState(Qt::Checked);
- gpx.getRoutes()[i].setVisible(true);
- mapWidget->setRouteVisibility(i, true);
+ gpx_.getRoutes()[i].setVisible(true);
+ mapWidget_->setRouteVisibility(i, true);
return;
}
}
//-------------------------------------------------------------------------
void GMapDialog::waypointClickedX(int i)
{
- if (i>=0 && i < wptList.size()) {
- QStandardItem *it = wptList[i];
- QModelIndex idx = model->indexFromItem(it);
- ui.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
- ui.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
+ if (i>=0 && i < wptList_.size()) {
+ QStandardItem *it = wptList_[i];
+ QModelIndex idx = model_->indexFromItem(it);
+ ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
+ ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
}
}
//-------------------------------------------------------------------------
void GMapDialog::trackClickedX(int i)
{
- if (i>=0 && i <trkList.size()) {
- QStandardItem *it = trkList[i];
- QModelIndex idx = model->indexFromItem(it);
- ui.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
- ui.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
+ if (i>=0 && i <trkList_.size()) {
+ QStandardItem *it = trkList_[i];
+ QModelIndex idx = model_->indexFromItem(it);
+ ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
+ ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
}
}
//-------------------------------------------------------------------------
void GMapDialog::routeClickedX(int i)
{
- if (i>=0 && i <rteList.size()) {
- QStandardItem *it = rteList[i];
- QModelIndex idx = model->indexFromItem(it);
- ui.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
- ui.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
+ if (i>=0 && i <rteList_.size()) {
+ QStandardItem *it = rteList_[i];
+ QModelIndex idx = model_->indexFromItem(it);
+ ui_.treeView->scrollTo(idx, QAbstractItemView::PositionAtCenter);
+ ui_.treeView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
}
}
void GMapDialog::selectionChangedX (const QItemSelection &sel, const QItemSelection &desel)
{
int k=0;
- foreach (QStandardItem*w, wptList) {
- QModelIndex idx = model->indexFromItem(w);
+ foreach (QStandardItem*w, wptList_) {
+ QModelIndex idx = model_->indexFromItem(w);
if (desel.contains(idx))
- mapWidget->setWaypointColorBlue(k);
+ mapWidget_->setWaypointColorBlue(k);
if (sel.contains(idx))
- mapWidget->setWaypointColorRed(k);
+ mapWidget_->setWaypointColorRed(k);
k++;
}
}
void GMapDialog::expandCollapseAll(const QList<QStandardItem *> &li,
QStandardItem *top, bool exp)
{
- ui.treeView->setExpanded(model->indexFromItem(top), exp);
+ ui_.treeView->setExpanded(model_->indexFromItem(top), exp);
foreach (QStandardItem*it, li) {
- QModelIndex idx = model->indexFromItem(it);
- ui.treeView->setExpanded(idx, exp);
+ QModelIndex idx = model_->indexFromItem(it);
+ ui_.treeView->setExpanded(idx, exp);
}
}
//------------------------------------------------------------------------
void GMapDialog::expandAllWaypoints()
{
- expandCollapseAll(wptList, wptItem, true);
+ expandCollapseAll(wptList_, wptItem_, true);
}
//------------------------------------------------------------------------
void GMapDialog::expandAllTracks()
{
- expandCollapseAll(trkList, trkItem, true);
+ expandCollapseAll(trkList_, trkItem_, true);
}
//------------------------------------------------------------------------
void GMapDialog::expandAllRoutes()
{
- expandCollapseAll(rteList, rteItem, true);
+ expandCollapseAll(rteList_, rteItem_, true);
}
//------------------------------------------------------------------------
void GMapDialog::collapseAllWaypoints()
{
- expandCollapseAll(wptList, wptItem,false);
+ expandCollapseAll(wptList_, wptItem_,false);
}
//------------------------------------------------------------------------
void GMapDialog::collapseAllTracks()
{
- expandCollapseAll(trkList, trkItem,false);
+ expandCollapseAll(trkList_, trkItem_,false);
}
//------------------------------------------------------------------------
void GMapDialog::collapseAllRoutes()
{
- expandCollapseAll(rteList, rteItem,false);
+ expandCollapseAll(rteList_, rteItem_,false);
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void GMapDialog::showAllWaypoints()
{
- foreach (GpxWaypoint wpt, gpx.getWaypoints())
+ foreach (GpxWaypoint wpt, gpx_.getWaypoints())
wpt.setVisible(true);
- checkUncheckAll(wptList, wptItem, true);
- mapWidget->showWaypoints(gpx.getWaypoints());
+ checkUncheckAll(wptList_, wptItem_, true);
+ mapWidget_->showWaypoints(gpx_.getWaypoints());
}
//------------------------------------------------------------------------
void GMapDialog::showAllTracks()
{
- foreach (GpxTrack trk, gpx.getTracks())
+ foreach (GpxTrack trk, gpx_.getTracks())
trk.setVisible(true);
- checkUncheckAll(trkList, trkItem, true);
- mapWidget->showTracks(gpx.getTracks());
+ checkUncheckAll(trkList_, trkItem_, true);
+ mapWidget_->showTracks(gpx_.getTracks());
}
//------------------------------------------------------------------------
void GMapDialog::showAllRoutes()
{
- foreach (GpxRoute rte, gpx.getRoutes())
+ foreach (GpxRoute rte, gpx_.getRoutes())
rte.setVisible(true);
- checkUncheckAll(rteList, rteItem, true);
- mapWidget->showRoutes(gpx.getRoutes());
+ checkUncheckAll(rteList_, rteItem_, true);
+ mapWidget_->showRoutes(gpx_.getRoutes());
}
//------------------------------------------------------------------------
void GMapDialog::hideAllWaypoints()
{
- foreach (GpxWaypoint wpt, gpx.getWaypoints())
+ foreach (GpxWaypoint wpt, gpx_.getWaypoints())
wpt.setVisible(false);
- checkUncheckAll(wptList, wptItem, false);
- mapWidget->showWaypoints(gpx.getWaypoints());
+ checkUncheckAll(wptList_, wptItem_, false);
+ mapWidget_->showWaypoints(gpx_.getWaypoints());
}
//------------------------------------------------------------------------
void GMapDialog::hideAllTracks()
{
- foreach (GpxTrack trk, gpx.getTracks())
+ foreach (GpxTrack trk, gpx_.getTracks())
trk.setVisible(false);
- checkUncheckAll(trkList, trkItem, false);
- mapWidget->showTracks(gpx.getTracks());
+ checkUncheckAll(trkList_, trkItem_, false);
+ mapWidget_->showTracks(gpx_.getTracks());
}
//------------------------------------------------------------------------
void GMapDialog::hideAllRoutes()
{
- foreach (GpxRoute rte, gpx.getRoutes())
+ foreach (GpxRoute rte, gpx_.getRoutes())
rte.setVisible(false);
- checkUncheckAll(rteList, rteItem, false);
- mapWidget->showRoutes(gpx.getRoutes());
+ checkUncheckAll(rteList_, rteItem_, false);
+ mapWidget_->showRoutes(gpx_.getRoutes());
}
//------------------------------------------------------------------------
void GMapDialog::showOnlyThisWaypoint()
{
- QList <GpxWaypoint> &tlist = gpx.getWaypoints();
+ QList <GpxWaypoint> &tlist = gpx_.getWaypoints();
for (int i=0; i<tlist.size(); i++) {
- tlist[i].setVisible(i == menuIndex? true: false);
- trkList[i]->setCheckState(i==menuIndex? Qt::Checked: Qt::Unchecked);
+ tlist[i].setVisible(i == menuIndex_? true: false);
+ trkList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
}
- wptItem->setCheckState(Qt::Checked);
- mapWidget->showWaypoints(gpx.getWaypoints());
+ wptItem_->setCheckState(Qt::Checked);
+ mapWidget_->showWaypoints(gpx_.getWaypoints());
}
//------------------------------------------------------------------------
void GMapDialog::showOnlyThisTrack()
{
- QList <GpxTrack> &tlist = gpx.getTracks();
+ QList <GpxTrack> &tlist = gpx_.getTracks();
for (int i=0; i<tlist.size(); i++) {
- tlist[i].setVisible(i == menuIndex? true: false);
- trkList[i]->setCheckState(i==menuIndex? Qt::Checked: Qt::Unchecked);
+ tlist[i].setVisible(i == menuIndex_? true: false);
+ trkList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
}
- trkItem->setCheckState(Qt::Checked);
- mapWidget->showTracks(gpx.getTracks());
+ trkItem_->setCheckState(Qt::Checked);
+ mapWidget_->showTracks(gpx_.getTracks());
}
//------------------------------------------------------------------------
void GMapDialog::showOnlyThisRoute()
{
- QList <GpxRoute> &rlist = gpx.getRoutes();
+ QList <GpxRoute> &rlist = gpx_.getRoutes();
for (int i=0; i<rlist.size(); i++) {
- rlist[i].setVisible(i == menuIndex? true: false);
- rteList[i]->setCheckState(i==menuIndex? Qt::Checked: Qt::Unchecked);
+ rlist[i].setVisible(i == menuIndex_? true: false);
+ rteList_[i]->setCheckState(i==menuIndex_? Qt::Checked: Qt::Unchecked);
}
- rteItem->setCheckState(Qt::Checked);
- mapWidget->showRoutes(gpx.getRoutes());
+ rteItem_->setCheckState(Qt::Checked);
+ mapWidget_->showRoutes(gpx_.getRoutes());
}
//------------------------------------------------------------------------
void GMapDialog::showContextMenu(const QPoint &pt)
{
- QModelIndex idx = ui.treeView->indexAt(pt);
- QStandardItem *it = model->itemFromIndex(idx);
+ QModelIndex idx = ui_.treeView->indexAt(pt);
+ QStandardItem *it = model_->itemFromIndex(idx);
int j;
- if (model->indexFromItem(wptItem) == idx) {
+ if (model_->indexFromItem(wptItem_) == idx) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show All Waypoints"), this, SLOT(showAllWaypoints()), &menu));
menu.addAction(new TreeAction(tr("Hide All Waypoints"), this, SLOT(hideAllWaypoints()),&menu));
menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllWaypoints()),&menu));
menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllWaypoints()),&menu));
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
- else if (model->indexFromItem(rteItem) == idx) {
+ else if (model_->indexFromItem(rteItem_) == idx) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show All Routes"), this, SLOT(showAllRoutes()), &menu));
menu.addAction(new TreeAction(tr("Hide All Routes"), this, SLOT(hideAllRoutes()),&menu));
menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllRoutes()),&menu));
menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllRoutes()),&menu));
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
- else if (model->indexFromItem(trkItem) == idx) {
+ else if (model_->indexFromItem(trkItem_) == idx) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show All Tracks"), this, SLOT(showAllTracks()), &menu));
menu.addAction(new TreeAction(tr("Hide All Tracks"), this, SLOT(hideAllTracks()),&menu));
menu.addAction(new TreeAction(tr("Expand All"), this, SLOT(expandAllTracks()),&menu));
menu.addAction(new TreeAction(tr("Collapse All"), this, SLOT(collapseAllTracks()),&menu));
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
else if ((j = waypointIndex(it)) >=0) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show Only This Waypoint"), this, SLOT(showOnlyThisWaypoint()), &menu));
- menuIndex = j;
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menuIndex_ = j;
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
else if ((j = trackIndex(it)) >=0) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show Only This Track"), this, SLOT(showOnlyThisTrack()), &menu));
- menuIndex = j;
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menuIndex_ = j;
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
else if ((j = routeIndex(it)) >=0) {
QMenu menu(this);
menu.addAction(new TreeAction(tr("Show Only This Route"), this, SLOT(showOnlyThisRoute()), &menu));
- menuIndex = j;
- menu.exec(ui.treeView->mapToGlobal(pt));
+ menuIndex_ = j;
+ menu.exec(ui_.treeView->mapToGlobal(pt));
}
else {
}
GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEdit *te);
private:
- Ui_GMapDlg ui;
- Map *mapWidget;
- bool showWaypoints, showRoutes, showTracks;
- QStandardItemModel *model;
- QStandardItem *wptItem, *trkItem, *rteItem;
- QList<QStandardItem *> wptList, trkList, rteList;
- Gpx gpx;
-
+ Ui_GMapDlg ui_;
+ Map *mapWidget_;
+ bool showWaypoints_, showRoutes_, showTracks_;
+ QStandardItemModel *model_;
+ QStandardItem *wptItem_, *trkItem_, *rteItem_;
+ QList<QStandardItem *> wptList_, trkList_, rteList_;
+ Gpx gpx_;
+ int menuIndex_;
+
void appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt);
void appendTrackInfo(QStandardItem *it, const GpxTrack &trk);
void appendRouteInfo(QStandardItem *it, const GpxRoute &rte);
int routeIndex(QStandardItem *it);
QString formatLength(double l);
- int menuIndex;
-
//
private slots:
void itemChangedX(QStandardItem *);
{
public:
GpxWaypoint(): GpxItem(),
- location(LatLng(0, 0)),
- elevation (-1.0E-100),
- name(QString()),
- comment(QString()),
- description(QString()),
- symbol(QString())
+ location_(LatLng(0, 0)),
+ elevation_ (-1.0E-100),
+ name_(QString()),
+ comment_(QString()),
+ description_(QString()),
+ symbol_(QString())
{};
- void setLocation(const LatLng& pt) { location = pt; };
- LatLng getLocation() const { return location; };
+ void setLocation(const LatLng& pt) { location_ = pt; };
+ LatLng getLocation() const { return location_; };
- void setElevation(double e) { elevation = e; };
- double getElevation () const { return elevation; };
+ void setElevation(double e) { elevation_ = e; };
+ double getElevation () const { return elevation_; };
- void setName(const QString &s) { name = s; };
- QString getName() const { return name; };
+ void setName(const QString &s) { name_ = s; };
+ QString getName() const { return name_; };
- void setComment(const QString &s) { comment = s; };
- QString getComment() const { return comment; };
+ void setComment(const QString &s) { comment_ = s; };
+ QString getComment() const { return comment_; };
- void setDescription(const QString &s) { description = s; };
- QString getDescription() const { return description; };
+ void setDescription(const QString &s) { description_ = s; };
+ QString getDescription() const { return description_; };
- void setSymbol(const QString &s) { symbol = s; };
- QString getSymbol() const { return symbol; };
+ void setSymbol(const QString &s) { symbol_ = s; };
+ QString getSymbol() const { return symbol_; };
private:
- LatLng location;
- double elevation;
- QString name;
- QString comment;
- QString description;
- QString symbol;
+ LatLng location_;
+ double elevation_;
+ QString name_;
+ QString comment_;
+ QString description_;
+ QString symbol_;
};
//------------------------------------------------------------------------
#include "version_mismatch.h"
#include "upgrade.h"
-const int BabelData::noType = -1;
-const int BabelData::fileType = 0;
-const int BabelData::deviceType = 1;
+const int BabelData::noType_ = -1;
+const int BabelData::fileType_ = 0;
+const int BabelData::deviceType_ = 1;
#define FAKE_LANGUAGE_MENU 0
// If this is a beta version (which means the user consciously downloaded
// it and decided to be on the beta track or the user has ticked the
// 'suggest beta upgrade' box, allow betas to be suggested for installation.
- return isBeta_ || babelData_.allowBetaUpgrades;
+ return isBeta_ || babelData_.allowBetaUpgrades_;
}
//------------------------------------------------------------------------
static QString MakeOptions(const QList<FormatOption>& options)
{
QString str;
- for (int i=0; i<options.size(); i++) {
- if (options[i].getSelected()) {
+ for (int i = 0; i< options.size(); i++) {
+ FormatOption option = options[i];
+ if (option.getSelected()) {
// For OPTbool, 'selected' is the key, not value.
- if (options[i].getType() == FormatOption::OPTbool) {
+ if (option.getType() == FormatOption::OPTbool) {
// Only write "foo=1" if that's not already the default.
- if (options[i].getDefaultValue() != "1") {
- str += "," + options[i].getName() + "=1";
+ if (option.getDefaultValue() != "1") {
+ str += "," + option.getName() + "=1";
}
} else {
- str += "," + options[i].getName() + "=" + options[i].getValue().toString();
+ str += "," + option.getName() + "=" + option.getValue().toString();
}
} else {
// For every boolean option not selected, explictly
// turn it off here, but only if the default isn't zero
// or given.
- if (options[i].getType() == FormatOption::OPTbool &&
- options[i].getDefaultValue() != "0" &&
- options[i].getDefaultValue() != "") {
- str += "," + options[i].getName() + "=0";
+ if (option.getType() == FormatOption::OPTbool &&
+ option.getDefaultValue() != "0" &&
+ option.getDefaultValue() != "") {
+ str += "," + option.getName() + "=0";
}
}
}
restoreSettings();
upgrade = new UpgradeCheck(parent, formatList_, babelData_);
- if (babelData_.startupVersionCheck) {
- upgrade->checkForUpgrade(babelVersion_, babelData_.upgradeCheckTime,
+ if (babelData_.startupVersionCheck_) {
+ upgrade->checkForUpgrade(babelVersion_, babelData_.upgradeCheckTime_,
allowBetaUpgrades());
}
- if (!babelData_.ignoreVersionMismatch && babelVersion_ != VERSION) {
+ if (!babelData_.ignoreVersionMismatch_ && babelVersion_ != VERSION) {
VersionMismatch vm(0, babelVersion_, QString(VERSION));
vm.exec();
- babelData_.ignoreVersionMismatch = vm.neverAgain();
+ babelData_.ignoreVersionMismatch_ = vm.neverAgain();
}
}
//------------------------------------------------------------------------
void MainWindow::checkCharSetCombos()
{
- ui_.inputCharSetCombo->setEnabled(babelData_.enableCharSetXform);
- ui_.outputCharSetCombo->setEnabled(babelData_.enableCharSetXform);
- ui_.inputCharSetCombo->setVisible(babelData_.enableCharSetXform);
- ui_.outputCharSetCombo->setVisible(babelData_.enableCharSetXform);
+ ui_.inputCharSetCombo->setEnabled(babelData_.enableCharSetXform_);
+ ui_.outputCharSetCombo->setEnabled(babelData_.enableCharSetXform_);
+ ui_.inputCharSetCombo->setVisible(babelData_.enableCharSetXform_);
+ ui_.outputCharSetCombo->setVisible(babelData_.enableCharSetXform_);
}
//------------------------------------------------------------------------
void MainWindow::inputFileOptBtnClicked()
{
fmtChgInterlock_ = true;
- QString fmt = babelData_.inputFileFormat;
+ QString fmt = babelData_.inputFileFormat_;
ui_.inputStackedWidget->setCurrentWidget(ui_.inputFilePage);
QList<int>indices = inputFileFormatIndices();
ui_.inputFormatCombo->clear();
void MainWindow::inputDeviceOptBtnClicked()
{
fmtChgInterlock_ = true;
- QString fmt = babelData_.inputDeviceFormat;
+ QString fmt = babelData_.inputDeviceFormat_;
ui_.inputStackedWidget->setCurrentWidget(ui_.inputDevicePage);
QList<int>indices = inputDeviceFormatIndices();
ui_.inputFormatCombo->clear();
if (ui_.outputFileOptBtn->isChecked()) {
ui_.outputFilePage->setEnabled(true);
ui_.outputDeviceOptBtn->setChecked(false);
- QString fmt = babelData_.outputFileFormat;
+ QString fmt = babelData_.outputFileFormat_;
ui_.outputStackedWidget->setCurrentWidget(ui_.outputFilePage);
QList<int>indices = outputFileFormatIndices();
ui_.outputFormatCombo->clear();
if (ui_.outputDeviceOptBtn->isChecked()) {
ui_.outputDevicePage->setEnabled(true);
ui_.outputFileOptBtn->setChecked(false);
- QString fmt = babelData_.outputDeviceFormat;
+ QString fmt = babelData_.outputDeviceFormat_;
ui_.outputStackedWidget->setCurrentWidget(ui_.outputDevicePage);
QList<int>indices = outputDeviceFormatIndices();
ui_.outputFormatCombo->clear();
}
void MainWindow::inputFileNameEdited()
{
- babelData_.inputFileNames.clear();
- babelData_.inputFileNames << ui_.inputFileNameText->text();
+ babelData_.inputFileNames_.clear();
+ babelData_.inputFileNames_ << ui_.inputFileNameText->text();
}
void MainWindow::outputFileNameEdited()
{
- babelData_.outputFileName = ui_.outputFileNameText->text();
+ babelData_.outputFileName_ = ui_.outputFileNameText->text();
}
//------------------------------------------------------------------------
void MainWindow::browseInputFile()
{
- QString startFile = babelData_.inputFileNames.size() ? babelData_.inputFileNames[0] : babelData_.inputBrowse;
+ QString startFile = babelData_.inputFileNames_.size() ? babelData_.inputFileNames_[0] : babelData_.inputBrowse_;
int idx = currentComboFormatIndex(ui_.inputFormatCombo);
QFileInfo finfo(startFile);
if (!finfo.isDir() && (!filterForFormatIncludes(idx, finfo.suffix()))) {
startFile,
filterForFormat(idx));
if (userList.size()) {
- babelData_.inputBrowse = userList[0];
- babelData_.inputFileNames = userList;
+ babelData_.inputBrowse_ = userList[0];
+ babelData_.inputFileNames_ = userList;
QString str;
- for (int i=0; i<babelData_.inputFileNames.size(); i++) {
+ for (int i=0; i<babelData_.inputFileNames_.size(); i++) {
if (i != 0)
str += ", ";
- str += "\"" + babelData_.inputFileNames[i] + "\"";
+ str += "\"" + babelData_.inputFileNames_[i] + "\"";
}
ui_.inputFileNameText->setText(str);
}
void MainWindow::browseOutputFile()
{
int idx = currentComboFormatIndex(ui_.outputFormatCombo);
- QString startFile = babelData_.outputFileName.length() == 0 ? babelData_.outputBrowse : babelData_.outputFileName;
+ QString startFile = babelData_.outputFileName_.length() == 0 ? babelData_.outputBrowse_ : babelData_.outputFileName_;
QFileInfo finfo(startFile);
if (!finfo.isDir() && (!filterForFormatIncludes(idx, finfo.suffix()))) {
startFile = finfo.dir().absolutePath();
filterForFormat(idx));
if (str.length() != 0) {
str = ensureExtensionPresent(str, idx);
- babelData_.outputBrowse = str;
- babelData_.outputFileName = str;
+ babelData_.outputBrowse_ = str;
+ babelData_.outputFileName_ = str;
ui_.outputFileNameText->setText(str);
}
}
crossCheckInOutFormats();
if (ui_.inputFileOptBtn->isChecked())
- babelData_.inputFileFormat =formatList_[fidx].getName();
+ babelData_.inputFileFormat_ =formatList_[fidx].getName();
else
- babelData_.inputDeviceFormat = formatList_[fidx].getName();
+ babelData_.inputDeviceFormat_ = formatList_[fidx].getName();
loadInputDeviceNameCombo(formatList_[fidx].getName());
}
crossCheckInOutFormats();
if (ui_.outputFileOptBtn->isChecked())
- babelData_.outputFileFormat =formatList_[fidx].getName();
+ babelData_.outputFileFormat_ =formatList_[fidx].getName();
else if (ui_.outputDeviceOptBtn->isChecked())
- babelData_.outputDeviceFormat = formatList_[fidx].getName();
+ babelData_.outputDeviceFormat_ = formatList_[fidx].getName();
loadOutputDeviceNameCombo(formatList_[fidx].getName());
}
// Paper over what didn't happen in inputBrowse() if the user edited
// the filename fields directly.
- if ((babelData_.inputType == BabelData::fileType) &&
- (babelData_.inputFileNames.size() == 0) &&
+ if ((babelData_.inputType_ == BabelData::fileType_) &&
+ (babelData_.inputFileNames_.size() == 0) &&
(!ui_.inputFileNameText->text().isEmpty())) {
- babelData_.inputFileNames << ui_.inputFileNameText->text();
+ babelData_.inputFileNames_ << ui_.inputFileNameText->text();
}
- if ((babelData_.outputType == BabelData::fileType) &&
- (babelData_.outputFileName.size() == 0) &&
+ if ((babelData_.outputType_ == BabelData::fileType_) &&
+ (babelData_.outputFileName_.size() == 0) &&
(!ui_.outputFileNameText->text().isEmpty())) {
- babelData_.outputFileName = ui_.outputFileNameText->text();
+ babelData_.outputFileName_ = ui_.outputFileNameText->text();
}
- if ((babelData_.inputType == BabelData::fileType) &&
- (babelData_.inputFileNames.size() == 0)) {
+ if ((babelData_.inputType_ == BabelData::fileType_) &&
+ (babelData_.inputFileNames_.size() == 0)) {
QMessageBox::information(0, QString(appName), tr("No input file specified"));
return false;
}
- if (babelData_.outputType == BabelData::noType && babelData_.previewGmap == true) {
+ if (babelData_.outputType_ == BabelData::noType_ && babelData_.previewGmap_ == true) {
}
- if (babelData_.outputType == BabelData::noType && babelData_.previewGmap == false) {
+ if (babelData_.outputType_ == BabelData::noType_ && babelData_.previewGmap_ == false) {
QMessageBox::information(0, QString(appName), tr("No valid output specified"));
return false;
}
- else if (babelData_.outputType == BabelData::fileType &&
- babelData_.outputFileName.length() == 0) {
+ else if (babelData_.outputType_ == BabelData::fileType_ &&
+ babelData_.outputFileName_.length() == 0) {
QMessageBox::information(0, QString(appName), tr("No output file specified"));
return false;
}
QStringList args;
- if (babelData_.debugLevel >=0) args << QString("-D%1").arg(babelData_.debugLevel);
- if (babelData_.synthShortNames) args << "-s";
+ if (babelData_.debugLevel_ >=0) args << QString("-D%1").arg(babelData_.debugLevel_);
+ if (babelData_.synthShortNames_) args << "-s";
// Input char set if specified
- if (babelData_.enableCharSetXform && babelData_.inputCharSet != QString())
- args << "-c" << babelData_.inputCharSet;
+ if (babelData_.enableCharSetXform_ && babelData_.inputCharSet_ != QString())
+ args << "-c" << babelData_.inputCharSet_;
Format ifmt = formatList_[currentComboFormatIndex(ui_.inputFormatCombo)];
Format ofmt = formatList_[currentComboFormatIndex(ui_.outputFormatCombo)];
- if (babelData_.xlateWayPts && ifmt.isReadWaypoints() && ofmt.isWriteWaypoints())
+ if (babelData_.xlateWayPts_ && ifmt.isReadWaypoints() && ofmt.isWriteWaypoints())
args << "-w";
- if (babelData_.xlateRoutes && ifmt.isReadRoutes() && ofmt.isWriteRoutes())
+ if (babelData_.xlateRoutes_ && ifmt.isReadRoutes() && ofmt.isWriteRoutes())
args << "-r";
- if (babelData_.xlateTracks && ifmt.isReadTracks() && ofmt.isWriteTracks())
+ if (babelData_.xlateTracks_ && ifmt.isReadTracks() && ofmt.isWriteTracks())
args << "-t";
// Input type, with options
- bool iisFile = (babelData_.inputType == BabelData::fileType);
+ bool iisFile = (babelData_.inputType_ == BabelData::fileType_);
int fidx = formatIndexFromName(iisFile, iisFile ?
- babelData_.inputFileFormat : babelData_.inputDeviceFormat);
+ babelData_.inputFileFormat_ : babelData_.inputDeviceFormat_);
args << "-i";
args << (formatList_[fidx].getName() + MakeOptions(formatList_[fidx].getInputOptions()));
// Input file(s) or device
int read_use_count = 0;
- if (babelData_.inputType == BabelData::fileType) {
- for (int i=0; i<babelData_.inputFileNames.size(); i++) {
- args << "-f" << babelData_.inputFileNames[i];
+ if (babelData_.inputType_ == BabelData::fileType_) {
+ for (int i=0; i<babelData_.inputFileNames_.size(); i++) {
+ args << "-f" << babelData_.inputFileNames_[i];
read_use_count++;
}
}
else {
- args << "-f" << babelData_.inputDeviceName;
+ args << "-f" << babelData_.inputDeviceName_;
read_use_count++;
}
formatList_[fidx].bumpReadUseCount(read_use_count);
args << filterData_.getAllFilterStrings();
// Output char set if specified
- if (babelData_.enableCharSetXform && babelData_.outputCharSet != QString())
- args << "-c" << babelData_.outputCharSet;
+ if (babelData_.enableCharSetXform_ && babelData_.outputCharSet_ != QString())
+ args << "-c" << babelData_.outputCharSet_;
// Output type, with options
- if (babelData_.outputType != BabelData::noType) {
- bool outIsFile = (babelData_.outputType == BabelData::fileType);
+ if (babelData_.outputType_ != BabelData::noType_) {
+ bool outIsFile = (babelData_.outputType_ == BabelData::fileType_);
fidx = formatIndexFromName(outIsFile, (outIsFile ?
- babelData_.outputFileFormat : babelData_.outputDeviceFormat));
+ babelData_.outputFileFormat_ : babelData_.outputDeviceFormat_));
args << "-o";
args << (formatList_[fidx].getName() + MakeOptions(formatList_[fidx].getOutputOptions()));
// output file or device option
if (outIsFile) {
- if (babelData_.outputFileName != "")
- args << "-F" << babelData_.outputFileName;
+ if (babelData_.outputFileName_ != "")
+ args << "-F" << babelData_.outputFileName_;
}
- else if (babelData_.outputType == BabelData::deviceType) {
- args << "-F" << babelData_.outputDeviceName;
+ else if (babelData_.outputType_ == BabelData::deviceType_) {
+ args << "-F" << babelData_.outputDeviceName_;
}
// GUI only ever writes a single file at a time.
formatList_[fidx].bumpWriteUseCount(1);
// Now output for preview in google maps
QString tempName;
- if (babelData_.previewGmap) {
+ if (babelData_.previewGmap_) {
QTemporaryFile ftemp;
ftemp.open();
tempName = ftemp.fileName();
ui_.outputWindow->appendPlainText(outputString);
if (x) {
ui_.outputWindow->appendPlainText(tr("Translation successful"));
- if (babelData_.previewGmap) {
+ if (babelData_.previewGmap_) {
this->hide();
- GMapDialog dlg(0, tempName, babelData_.debugLevel >=1 ? ui_.outputWindow : 0);
+ GMapDialog dlg(0, tempName, babelData_.debugLevel_ >=1 ? ui_.outputWindow : 0);
dlg.show();
dlg.exec();
this->show();
{
QDateTime wt= upgrade->getUpgradeWarningTime();
if (wt.isValid()) {
- babelData_.upgradeCheckTime = wt;
+ babelData_.upgradeCheckTime_ = wt;
}
- babelData_.runCount++;
+ babelData_.runCount_++;
QDateTime now = QDateTime::currentDateTime();
- if ((babelData_.runCount > 5) && (babelData_.donateSplashed.daysTo(now) > 30)) {
+ if ((babelData_.runCount_ > 5) && (babelData_.donateSplashed_.daysTo(now) > 30)) {
Donate donate(0);
- if (babelData_.donateSplashed.date() == QDate(2010,1,1))
+ if (babelData_.donateSplashed_.date() == QDate(2010,1,1))
donate.showNever(false);
donate.exec();
- babelData_.donateSplashed = now;
+ babelData_.donateSplashed_ = now;
}
saveSettings();
delete upgrade;
foreach (QString format, event->mimeData()->formats()) {
if (format == "text/uri-list") {
QList<QUrl> urlList = event->mimeData()->urls();
- babelData_.inputFileNames.clear();
+ babelData_.inputFileNames_.clear();
for (int i = 0; i < urlList.size(); ++i) {
QFileInfo file_info(urlList.at(i).path());
QString name = file_info.filePath();
QString fmt = getFormatNameForExtension(ext);
setComboToFormat(ui_.inputFormatCombo, fmt, true);
ui_.inputFileNameText->setText(name);
- babelData_.inputFileNames << ui_.inputFileNameText->text();
+ babelData_.inputFileNames_ << ui_.inputFileNameText->text();
event->acceptProposedAction();
}
}
//------------------------------------------------------------------------
void MainWindow::moreOptionButtonClicked()
{
- AdvDlg advDlg(0, babelData_.synthShortNames,
- babelData_.enableCharSetXform, babelData_.previewGmap, babelData_.debugLevel);
+ AdvDlg advDlg(0, babelData_.synthShortNames_,
+ babelData_.enableCharSetXform_, babelData_.previewGmap_, babelData_.debugLevel_);
connect(advDlg.formatButton(), SIGNAL(clicked()),
this, SLOT(resetFormatDefaults()));
advDlg.exec();
//------------------------------------------------------------------------
void MainWindow::setWidgetValues()
{
- if (babelData_.inputType == BabelData::fileType) {
+ if (babelData_.inputType_ == BabelData::fileType_) {
ui_.inputFileOptBtn->setChecked(true);
inputFileOptBtnClicked();
- setComboToFormat(ui_.inputFormatCombo, babelData_.inputFileFormat, true);
+ setComboToFormat(ui_.inputFormatCombo, babelData_.inputFileFormat_, true);
ui_.inputStackedWidget->setCurrentWidget(ui_.inputFilePage);
}
else {
ui_.inputDeviceOptBtn->setChecked(true);
inputDeviceOptBtnClicked();
- setComboToFormat(ui_.inputFormatCombo, babelData_.inputDeviceFormat, false);
- loadInputDeviceNameCombo(babelData_.inputDeviceFormat);
+ setComboToFormat(ui_.inputFormatCombo, babelData_.inputDeviceFormat_, false);
+ loadInputDeviceNameCombo(babelData_.inputDeviceFormat_);
ui_.inputStackedWidget->setCurrentWidget(ui_.inputDevicePage);
}
- setComboToDevice(ui_.inputDeviceNameCombo, babelData_.inputDeviceName);
- setComboToCharSet(ui_.inputCharSetCombo, babelData_.inputCharSet);
+ setComboToDevice(ui_.inputDeviceNameCombo, babelData_.inputDeviceName_);
+ setComboToCharSet(ui_.inputCharSetCombo, babelData_.inputCharSet_);
- if (babelData_.outputType == BabelData::fileType) {
+ if (babelData_.outputType_ == BabelData::fileType_) {
ui_.outputFileOptBtn->setChecked(true);
outputFileOptBtnClicked();
- setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat, true);
+ setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat_, true);
ui_.outputStackedWidget->setCurrentWidget(ui_.outputFilePage);
}
- else if (babelData_.outputType == BabelData::deviceType) {
+ else if (babelData_.outputType_ == BabelData::deviceType_) {
ui_.outputDeviceOptBtn->setChecked(true);
outputDeviceOptBtnClicked();
- setComboToFormat(ui_.outputFormatCombo, babelData_.outputDeviceFormat, false);
- loadOutputDeviceNameCombo(babelData_.outputDeviceFormat);
+ setComboToFormat(ui_.outputFormatCombo, babelData_.outputDeviceFormat_, false);
+ loadOutputDeviceNameCombo(babelData_.outputDeviceFormat_);
ui_.outputStackedWidget->setCurrentWidget(ui_.outputDevicePage);
}
else {
ui_.outputFileOptBtn->setChecked(false);
ui_.outputDeviceOptBtn->setChecked(false);
- setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat, true);
+ setComboToFormat(ui_.outputFormatCombo, babelData_.outputFileFormat_, true);
ui_.outputStackedWidget->setCurrentWidget(ui_.outputFilePage);
ui_.outputFilePage->setDisabled(true);
}
- setComboToDevice(ui_.outputDeviceNameCombo, babelData_.outputDeviceName);
- setComboToCharSet(ui_.outputCharSetCombo, babelData_.outputCharSet);
+ setComboToDevice(ui_.outputDeviceNameCombo, babelData_.outputDeviceName_);
+ setComboToCharSet(ui_.outputCharSetCombo, babelData_.outputCharSet_);
- ui_.xlateWayPtsCk->setChecked(babelData_.xlateWayPts);
- ui_.xlateTracksCk->setChecked(babelData_.xlateTracks);
- ui_.xlateRoutesCk->setChecked(babelData_.xlateRoutes);
+ ui_.xlateWayPtsCk->setChecked(babelData_.xlateWayPts_);
+ ui_.xlateTracksCk->setChecked(babelData_.xlateTracks_);
+ ui_.xlateRoutesCk->setChecked(babelData_.xlateRoutes_);
crossCheckInOutFormats();
displayOptionsText(ui_.inputOptionsText, ui_.inputFormatCombo, true);
int comboIdx = ui_.inputFormatCombo->currentIndex();
int fidx = ui_.inputFormatCombo->itemData(comboIdx).toInt();
if (ui_.inputFileOptBtn->isChecked()){
- babelData_.inputType = BabelData::fileType;
- babelData_.inputFileFormat =formatList_[fidx].getName();
+ babelData_.inputType_ = BabelData::fileType_;
+ babelData_.inputFileFormat_ =formatList_[fidx].getName();
}
else {
- babelData_.inputType = BabelData::deviceType;
- babelData_.inputDeviceFormat =formatList_[fidx].getName();
+ babelData_.inputType_ = BabelData::deviceType_;
+ babelData_.inputDeviceFormat_ =formatList_[fidx].getName();
}
- babelData_.inputDeviceName = ui_.inputDeviceNameCombo->currentText();
- babelData_.inputCharSet = charSetFromCombo(ui_.inputCharSetCombo);
+ babelData_.inputDeviceName_ = ui_.inputDeviceNameCombo->currentText();
+ babelData_.inputCharSet_ = charSetFromCombo(ui_.inputCharSetCombo);
comboIdx = ui_.outputFormatCombo->currentIndex();
fidx = ui_.outputFormatCombo->itemData(comboIdx).toInt();
if (ui_.outputFileOptBtn->isChecked()){
- babelData_.outputType = BabelData::fileType;
- babelData_.outputFileFormat =formatList_[fidx].getName();
+ babelData_.outputType_ = BabelData::fileType_;
+ babelData_.outputFileFormat_ =formatList_[fidx].getName();
}
else if (ui_.outputDeviceOptBtn->isChecked()){
- babelData_.outputType = BabelData::deviceType;
- babelData_.outputDeviceFormat =formatList_[fidx].getName();
+ babelData_.outputType_ = BabelData::deviceType_;
+ babelData_.outputDeviceFormat_ =formatList_[fidx].getName();
}
else {
- babelData_.outputType = BabelData::noType;
+ babelData_.outputType_ = BabelData::noType_;
}
- babelData_.outputDeviceName = ui_.outputDeviceNameCombo->currentText();
- babelData_.outputCharSet = charSetFromCombo(ui_.outputCharSetCombo);
+ babelData_.outputDeviceName_ = ui_.outputDeviceNameCombo->currentText();
+ babelData_.outputCharSet_ = charSetFromCombo(ui_.outputCharSetCombo);
- babelData_.xlateWayPts = ui_.xlateWayPtsCk->isChecked();
- babelData_.xlateTracks = ui_.xlateTracksCk->isChecked();
- babelData_.xlateRoutes = ui_.xlateRoutesCk->isChecked();
+ babelData_.xlateWayPts_ = ui_.xlateWayPtsCk->isChecked();
+ babelData_.xlateTracks_ = ui_.xlateTracksCk->isChecked();
+ babelData_.xlateRoutes_ = ui_.xlateRoutesCk->isChecked();
}
// This could be made faster, but any attempt to do so would have to be
Map::Map(QWidget *parent,
const Gpx &gpx, QPlainTextEdit *te):
QWebView(parent),
- gpx(gpx),
- mapPresent(false),
- busyCursor(false),
- te(te)
+ gpx_(gpx),
+ mapPresent_(false),
+ busyCursor_(false),
+ textEdit_(te)
{
- busyCursor = true;
- stopWatch.start();
+ busyCursor_ = true;
+ stopWatch_.start();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- manager = new QNetworkAccessManager(this);
+ manager_ = new QNetworkAccessManager(this);
connect(this,SIGNAL(loadFinished(bool)),
this,SLOT(loadFinishedX(bool)));
this->logTimeX("Start map constuctor");
//------------------------------------------------------------------------
Map::~Map()
{
- if (busyCursor)
+ if (busyCursor_)
QApplication::restoreOverrideCursor();
}
//------------------------------------------------------------------------
showGpxData();
}
QApplication::restoreOverrideCursor();
- busyCursor = false;
+ busyCursor_ = false;
}
//------------------------------------------------------------------------
<< QString("var numLevels = %1;").arg(numLevels)
;
- mapPresent = true;
+ mapPresent_ = true;
// Waypoints.
int num=0;
- foreach (const GpxWaypoint &pt, gpx.getWaypoints() ) {
+ foreach (const GpxWaypoint &pt, gpx_.getWaypoints() ) {
scriptStr
<< QString("waypts[%1] = new GMarker(new GLatLng(%2), "
"{title:\"%3\",icon:blueIcon});")
// Tracks
num = 0;
- foreach (const GpxTrack &trk, gpx.getTracks()) {
+ foreach (const GpxTrack &trk, gpx_.getTracks()) {
vector <LatLng> epts;
foreach (const GpxTrackSegment seg, trk.getTrackSegments()) {
foreach (const GpxTrackPoint pt, seg.getTrackPoints()) {
// Routes
num = 0;
- foreach (const GpxRoute &rte, gpx.getRoutes()) {
+ foreach (const GpxRoute &rte, gpx_.getRoutes()) {
vector <LatLng> epts;
foreach (const GpxRoutePoint &pt, rte.getRoutePoints()) {
epts.push_back(pt.getLocation());
void Map::logTimeX(const QString &s)
{
// fprintf(stderr, "Log: %s: %d ms\n", s.toStdString().c_str(), stopWatch.elapsed());
- if (te) {
- te->appendPlainText(QString("%1: %2 ms").arg(s).arg(stopWatch.elapsed()));
+ if (textEdit_) {
+ textEdit_->appendPlainText(QString("%1: %2 ms").arg(s).arg(stopWatch_.elapsed()));
}
- stopWatch.start();
+ stopWatch_.start();
}
//------------------------------------------------------------------------
void Map::showTracks(const QList<GpxTrack> &tracks)
void Map::resizeEvent ( QResizeEvent * ev)
{
QWebView::resizeEvent(ev);
- if (mapPresent)
+ if (mapPresent_)
evaluateJS(QString("map.checkResize();"));
}
Q_OBJECT
public:
Map(QWidget *parent,
- const Gpx &gpx, QPlainTextEdit *te);
+ const Gpx &gpx_, QPlainTextEdit *textEdit_);
~Map();
public slots:
void routeClicked(int i);
private:
- QNetworkAccessManager *manager;
- const Gpx &gpx;
- bool mapPresent;
- bool busyCursor;
- QTime stopWatch;
- QPlainTextEdit *te;
+ QNetworkAccessManager *manager_;
+ const Gpx &gpx_;
+ bool mapPresent_;
+ bool busyCursor_;
+ QTime stopWatch_;
+ QPlainTextEdit *textEdit_;
void evaluateJS(const QString &s, bool update = true);
void evaluateJS(const QStringList &s, bool update = true);
OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QList<FormatOption>* opts,
const QString& htmlArg):
QDialog(parent),
- fmtName(fmtName),
- options(*opts),
- html(htmlArg)
+ fmtName_(fmtName),
+ options_(*opts),
+ html_(htmlArg)
{
if (htmlArg.isEmpty()) {
- html = "fmt_" + fmtName + ".html";
+ html_ = "fmt_" + fmtName + ".html";
}
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
- for (int k=0; k<options.size(); k++) {
+ for (int k=0; k<options_.size(); k++) {
QHBoxLayout* horizontalLayout = new QHBoxLayout();
QCheckBox* checkBox = new QCheckBox(this);
- checkBox->setText(options[k].getDescription());
+ checkBox->setText(options_[k].getDescription());
horizontalLayout->addWidget(checkBox);
- checkBox->setChecked(options[k].getSelected());
+ checkBox->setChecked(options_[k].getSelected());
//checkBox->setWhatsThis(options[k].getHtml());
QSpacerItem* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer);
QWidget* w = 0;
- switch (options[k].getType()) {
+ switch (options_[k].getType()) {
case FormatOption::OPTstring: {
QLineEdit* lineEdit = new QLineEdit(this);
SetSizeStuff(lineEdit);
- lineEdit->setText(getOptionValue(options, k).toString());
+ lineEdit->setText(getOptionValue(options_, k).toString());
w = lineEdit;
horizontalLayout->addWidget(lineEdit);
}
case FormatOption::OPTinFile:
case FormatOption::OPToutFile: {
- bool inFile = options[k].getType() == FormatOption::OPTinFile;
+ bool inFile = options_[k].getType() == FormatOption::OPTinFile;
QLineEdit* lineEdit = new QLineEdit(this);
QToolButton* button = new QToolButton(this);
- lineEdit->setText(getOptionValue(options, k).toString());
+ lineEdit->setText(getOptionValue(options_, k).toString());
button->setIcon(QIcon(inFile ? ":images/file.png" : ":images/save.png"));
w = lineEdit;
horizontalSpacer->changeSize(5, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
// This is quirky. It means that GPSBabel's bool options that default
// to true get turned on here, even if user turned them off on last
// exit.
- checkBox->setChecked(getOptionValue(options,k).toBool());
+ checkBox->setChecked(getOptionValue(options_,k).toBool());
w = 0;
break;
case FormatOption::OPTfloat: {
QLineEdit* lineEdit = new QLineEdit(this);
SetSizeStuff(lineEdit);
- lineEdit->setText(getOptionValue(options, k).toString());
+ lineEdit->setText(getOptionValue(options_, k).toString());
w = lineEdit;
- double minVal = options[k].getMinValue().toDouble();
- double maxVal = options[k].getMaxValue().toDouble();
+ double minVal = options_[k].getMinValue().toDouble();
+ double maxVal = options_[k].getMaxValue().toDouble();
if (minVal < maxVal) {
QDoubleValidator* v = new QDoubleValidator(this);
v->setRange(minVal, maxVal);
QLineEdit* lineEdit = new QLineEdit(this);
SetSizeStuff(lineEdit);
w = lineEdit;
- int minVal = options[k].getMinValue().toInt();
- int maxVal = options[k].getMaxValue().toInt();
+ int minVal = options_[k].getMinValue().toInt();
+ int maxVal = options_[k].getMaxValue().toInt();
if (minVal < maxVal) {
QIntValidator* iv = new QIntValidator(this);
iv->setRange(minVal, maxVal);
lineEdit->setValidator(iv);
}
- lineEdit->setText(getOptionValue(options, k).toString());
+ lineEdit->setText(getOptionValue(options_, k).toString());
horizontalLayout->addWidget(lineEdit);
}
break;
case FormatOption::OPTboundedInt: {
QSpinBox* spinBox = new QSpinBox(this);
- spinBox->setRange(options[k].getMinValue().toInt(),
- options[k].getMaxValue().toInt());
- spinBox->setValue(getOptionValue(options, k).toInt());
+ spinBox->setRange(options_[k].getMinValue().toInt(),
+ options_[k].getMaxValue().toInt());
+ spinBox->setValue(getOptionValue(options_, k).toInt());
SetSizeStuff(spinBox);
w = spinBox;
horizontalLayout->addWidget(spinBox);
}
break;
}
- checkBoxes.push_back(checkBox);
- fields.push_back(w);
+ checkBoxes_.push_back(checkBox);
+ fields_.push_back(w);
#if LATER
// 2013-12-30 robertlipe - because we can't pass arguments
// to slots, this requires QSignalMapper or the new lambda
QHBoxLayout* lay = new QHBoxLayout();
lay->addWidget(helpButton);
- buttonBox = new QDialogButtonBox(this);
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- lay->addWidget(buttonBox);
+ buttonBox_ = new QDialogButtonBox(this);
+ buttonBox_->setOrientation(Qt::Horizontal);
+ buttonBox_->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
+ lay->addWidget(buttonBox_);
verticalLayout->addLayout(lay);
- buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
- buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
+ buttonBox_->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok"));
+ buttonBox_->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel"));
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
+ connect(buttonBox_, SIGNAL(accepted()), this, SLOT(acceptClicked()));
+ connect(buttonBox_, SIGNAL(rejected()), this, SLOT(rejectClicked()));
connect(helpButton, SIGNAL(clicked()), this, SLOT(helpClicked()));
}
//------------------------------------------------------------------------
void OptionsDlg::acceptClicked()
{
- for (int k=0; k<options.size(); k++) {
- options[k].setSelected(checkBoxes[k]->isChecked());
- if (fields[k]) {
- if (options[k].getType() == FormatOption::OPTboundedInt) {
- int value = static_cast<QSpinBox*>(fields[k])->value();
- value = qMax(qMin(value, options[k].getMaxValue().toInt()),options[k].getMinValue().toInt());
- options[k].setValue(QVariant(value));
- } else if (options[k].getType() == FormatOption::OPTint) {
- int value = static_cast<QLineEdit*>(fields[k])->text().toInt();
- value = qMax(qMin(value, options[k].getMaxValue().toInt()),options[k].getMinValue().toInt());
- options[k].setValue(QVariant(value));
- } else if (options[k].getType() == FormatOption::OPTfloat) {
- double value = static_cast<QLineEdit*>(fields[k])->text().toDouble();
- value = qMax(qMin(value, options[k].getMaxValue().toDouble()),options[k].getMinValue().toDouble());
- options[k].setValue(QVariant(value));
+ for (int k=0; k<options_.size(); k++) {
+ options_[k].setSelected(checkBoxes_[k]->isChecked());
+ if (fields_[k]) {
+ if (options_[k].getType() == FormatOption::OPTboundedInt) {
+ int value = static_cast<QSpinBox*>(fields_[k])->value();
+ value = qMax(qMin(value, options_[k].getMaxValue().toInt()),options_[k].getMinValue().toInt());
+ options_[k].setValue(QVariant(value));
+ } else if (options_[k].getType() == FormatOption::OPTint) {
+ int value = static_cast<QLineEdit*>(fields_[k])->text().toInt();
+ value = qMax(qMin(value, options_[k].getMaxValue().toInt()),options_[k].getMinValue().toInt());
+ options_[k].setValue(QVariant(value));
+ } else if (options_[k].getType() == FormatOption::OPTfloat) {
+ double value = static_cast<QLineEdit*>(fields_[k])->text().toDouble();
+ value = qMax(qMin(value, options_[k].getMaxValue().toDouble()),options_[k].getMinValue().toDouble());
+ options_[k].setValue(QVariant(value));
} else {
- options[k].setValue(static_cast<QLineEdit*>(fields[k])->text());
+ options_[k].setValue(static_cast<QLineEdit*>(fields_[k])->text());
}
}
}
//------------------------------------------------------------------------
void OptionsDlg::helpClicked()
{
- ShowHelp(html);
+ ShowHelp(html_);
}
class OptionsDlg: public QDialog {
Q_OBJECT
public:
- OptionsDlg(QWidget *parent, const QString &fmtName, QList<FormatOption> *options,
- const QString &html);
+ OptionsDlg(QWidget *parent, const QString &fmtName_, QList<FormatOption> *options_,
+ const QString &html_);
private:
- QString fmtName;
- QList<FormatOption> &options;
- QDialogButtonBox *buttonBox;
- QList<QCheckBox*> checkBoxes;
- QList<QWidget*> fields;
- QString html;
+ QString fmtName_;
+ QList<FormatOption> &options_;
+ QDialogButtonBox *buttonBox_;
+ QList<QCheckBox*> checkBoxes_;
+ QList<QWidget*> fields_;
+ QString html_;
private slots:
void acceptClicked();
Preferences::Preferences(QWidget* parent, QList<Format>& formatList,
BabelData& bd) : QDialog(parent),
formatList_(formatList),
- bd_(bd)
+ babelData_(bd)
{
ui_.setupUi(this);
- ui_.startupCheck->setChecked(bd_.startupVersionCheck);
- ui_.reportStatisticsCheck->setChecked(bd_.reportStatistics);
- ui_.ignoreVersionMismatchCheck->setChecked(bd_.ignoreVersionMismatch);
+ ui_.startupCheck->setChecked(babelData_.startupVersionCheck_);
+ ui_.reportStatisticsCheck->setChecked(babelData_.reportStatistics_);
+ ui_.ignoreVersionMismatchCheck->setChecked(babelData_.ignoreVersionMismatch_);
// Because of an unfortunate bug in 1.4.0, we turn this off in 1.4.1.
if (VERSION == QString("1.4.1"))
- bd_.ignoreVersionMismatch = false;
+ babelData_.ignoreVersionMismatch_ = false;
connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
formatList_[i].setHidden(item->checkState() == Qt::Unchecked);
}
- bd_.startupVersionCheck = ui_.startupCheck->isChecked();
- bd_.reportStatistics = ui_.reportStatisticsCheck->isChecked();
- bd_.ignoreVersionMismatch = ui_.ignoreVersionMismatchCheck->isChecked();
+ babelData_.startupVersionCheck_ = ui_.startupCheck->isChecked();
+ babelData_.reportStatistics_ = ui_.reportStatisticsCheck->isChecked();
+ babelData_.ignoreVersionMismatch_ = ui_.ignoreVersionMismatchCheck->isChecked();
accept();
}
private:
QList<Format>& formatList_;
Ui_Preferences ui_;
- BabelData& bd_;
+ BabelData& babelData_;
private slots:
void enableAllClicked();
}
//------------------------------------------------------------------------
ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, QProcess *process):
- QDialog(parent), process(process)
+ QDialog(parent), process_(process)
{
this->resize(400, 220);
this->setWindowTitle(QString(appName) + tr(" ... Process GPSBabel"));
QVBoxLayout *layout = new QVBoxLayout(this);
- textEdit = new QPlainTextEdit(this);
- textEdit->setReadOnly(true);
- layout->addWidget(textEdit);
+ textEdit_ = new QPlainTextEdit(this);
+ textEdit_->setReadOnly(true);
+ layout->addWidget(textEdit_);
- progressBar = new QProgressBar(this);
- progressBar->setTextVisible(false);
- layout->addWidget(progressBar);
+ progressBar_ = new QProgressBar(this);
+ progressBar_->setTextVisible(false);
+ layout->addWidget(progressBar_);
- buttonBox = new QDialogButtonBox(this);
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Abort);
- QPushButton* btn = buttonBox->button(QDialogButtonBox::Abort);
+ buttonBox_ = new QDialogButtonBox(this);
+ buttonBox_->setOrientation(Qt::Horizontal);
+ buttonBox_->setStandardButtons(QDialogButtonBox::Abort);
+ QPushButton* btn = buttonBox_->button(QDialogButtonBox::Abort);
btn->setText(tr("Stop Process"));
- layout->addWidget(buttonBox);
+ layout->addWidget(buttonBox_);
connect(process, SIGNAL(error(QProcess::ProcessError)),
this, SLOT (errorX(QProcess::ProcessError)));
this, SLOT (readyReadStandardOutputX()));
connect(btn, SIGNAL(clicked()),
this, SLOT (stopClickedX()));
- estatus = QProcess::CrashExit; // Assume all errors are crashes for now.
+ exitStatus_ = QProcess::CrashExit; // Assume all errors are crashes for now.
- bufferedOut = "";
+ bufferedOut_ = "";
//
for (int i=0; i<=100; i+=2)
- progressVals.push_back(i);
+ progressVals_.push_back(i);
for (int i=98; i>0; i-=2)
- progressVals.push_back(i);
- progressIndex = progressVals.size()/2;
+ progressVals_.push_back(i);
+ progressIndex_ = progressVals_.size()/2;
- timer = new QTimer(this);
- timer->setInterval(100);
- timer->setSingleShot(false);
- connect(timer, SIGNAL(timeout()), this, SLOT(timeoutX()));
- stopCount = -1;
- timer->start();
- errorString = "";
+ timer_ = new QTimer(this);
+ timer_->setInterval(100);
+ timer_->setSingleShot(false);
+ connect(timer_, SIGNAL(timeout()), this, SLOT(timeoutX()));
+ stopCount_ = -1;
+ timer_->start();
+ errorString_ = "";
}
//------------------------------------------------------------------------
bool ProcessWaitDialog::getExitedNormally()
{
- return (errorString.length() == 0);
+ return (errorString_.length() == 0);
};
//------------------------------------------------------------------------
QString ProcessWaitDialog::getErrorString()
{
- return errorString;
+ return errorString_;
};
//------------------------------------------------------------------------
int ProcessWaitDialog::getExitCode()
{
- return ecode;
+ return ecode_;
};
//------------------------------------------------------------------------
void ProcessWaitDialog::stopClickedX()
{
- process->terminate();
+ process_->terminate();
};
//------------------------------------------------------------------------
void ProcessWaitDialog::timeoutX()
{
- progressIndex++;
- int idx = progressIndex % progressVals.size();
- progressBar->setValue(progressVals[idx]);
- if (stopCount >=0)
- stopCount++;
- if (stopCount > 150) {
- process->kill();
- errorString = QString(tr("Process did not terminate successfully"));
- timer->stop();
+ progressIndex_++;
+ int idx = progressIndex_ % progressVals_.size();
+ progressBar_->setValue(progressVals_[idx]);
+ if (stopCount_ >=0)
+ stopCount_++;
+ if (stopCount_ > 150) {
+ process_->kill();
+ errorString_ = QString(tr("Process did not terminate successfully"));
+ timer_->stop();
accept();
}
};
//------------------------------------------------------------------------
void ProcessWaitDialog::errorX(QProcess::ProcessError err)
{
- errorString = processErrorString(err);
- timer->stop();
+ errorString_ = processErrorString(err);
+ timer_->stop();
accept();
};
//------------------------------------------------------------------------
void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es)
{
- ecode = exitCode;
+ ecode_ = exitCode;
if (es == QProcess::CrashExit)
- errorString = QString(tr("Process crashed whle running"));
- timer->stop();
+ errorString_ = QString(tr("Process crashed whle running"));
+ timer_->stop();
accept();
};
//
void ProcessWaitDialog::appendToText(const char *ptr)
{
- outputString += QString(ptr);
+ outputString_ += QString(ptr);
for (const char *cptr = ptr; *cptr; cptr++) {
if (*cptr == '\r')
continue;
if (*cptr == '\n') {
- textEdit->appendPlainText(QString::fromStdString(bufferedOut));
- bufferedOut = "";
+ textEdit_->appendPlainText(QString::fromStdString(bufferedOut_));
+ bufferedOut_ = "";
continue;
}
- bufferedOut += *cptr;
+ bufferedOut_ += *cptr;
}
}
//------------------------------------------------------------------------
void ProcessWaitDialog::readyReadStandardErrorX()
{
- QByteArray d = process->readAllStandardError();
+ QByteArray d = process_->readAllStandardError();
appendToText(d.data());
};
//------------------------------------------------------------------------
void ProcessWaitDialog::readyReadStandardOutputX()
{
- QByteArray d = process->readAllStandardOutput();
+ QByteArray d = process_->readAllStandardOutput();
appendToText(d.data());
};
public:
//
- ProcessWaitDialog(QWidget *parent, QProcess *process);
+ ProcessWaitDialog(QWidget *parent, QProcess *process_);
~ProcessWaitDialog();
bool getExitedNormally();
int getExitCode();
QString getErrorString();
- QString getOutputString() const {return outputString;};
+ QString getOutputString() const {return outputString_;};
protected:
void closeEvent (QCloseEvent*event);
void stopClickedX();
private:
- vector <int> progressVals;
- int progressIndex;
- int stopCount;
- string bufferedOut;
- QProcess::ExitStatus estatus;
- int ecode;
- QProcess *process;
- QProgressBar *progressBar;
- QPlainTextEdit *textEdit;
- QDialogButtonBox *buttonBox;
- QTimer *timer;
- QString errorString;
- QString outputString;
+ vector <int> progressVals_;
+ int progressIndex_;
+ int stopCount_;
+ string bufferedOut_;
+ QProcess::ExitStatus exitStatus_;
+ int ecode_;
+ QProcess *process_;
+ QProgressBar *progressBar_;
+ QPlainTextEdit *textEdit_;
+ QDialogButtonBox *buttonBox_;
+ QTimer *timer_;
+ QString errorString_;
+ QString outputString_;
};
#endif
class IntSetting: public VarSetting
{
public:
- IntSetting(const QString &name, int &var): VarSetting(), name(name), var(var) { }
- void saveSetting(QSettings &st) {st.setValue(name, var); }
- void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value(name).toInt(); }
+ IntSetting(const QString &name, int &var): VarSetting(), name_(name), var_(var) { }
+ void saveSetting(QSettings &st) {st.setValue(name_, var_); }
+ void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toInt(); }
private:
- QString name;
- int &var;
+ QString name_;
+ int &var_;
};
//------------------------------------------------------------------------
class DoubleSetting: public VarSetting
{
public:
- DoubleSetting(const QString &name, double &var): VarSetting(), name(name), var(var) { }
- void saveSetting(QSettings &st) {st.setValue(name, var); }
- void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value(name).toDouble(); }
+ DoubleSetting(const QString &name, double &var): VarSetting(), name_(name), var_(var) { }
+ void saveSetting(QSettings &st) {st.setValue(name_, var_); }
+ void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toDouble(); }
private:
- QString name;
- double &var;
+ QString name_;
+ double &var_;
};
//------------------------------------------------------------------------
class StringSetting: public VarSetting
{
public:
- StringSetting(const QString &name, QString &var): VarSetting(), name(name), var(var) { }
- void saveSetting(QSettings &st) {st.setValue(name, var); }
- void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value(name).toString(); }
+ StringSetting(const QString &name, QString &var): VarSetting(), name_(name), var_(var) { }
+ void saveSetting(QSettings &st) {st.setValue(name_, var_); }
+ void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toString(); }
private:
- QString name;
- QString &var;
+ QString name_;
+ QString &var_;
};
//------------------------------------------------------------------------
class BoolSetting: public VarSetting
{
public:
- BoolSetting(const QString &name, bool &var): VarSetting(), name(name), var(var) { }
- void saveSetting(QSettings &st) {st.setValue(name, var); }
- void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value(name).toBool(); }
+ BoolSetting(const QString &name, bool &var): VarSetting(), name_(name), var_(var) { }
+ void saveSetting(QSettings &st) {st.setValue(name_, var_); }
+ void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toBool(); }
private:
- QString name;
- bool &var;
+ QString name_;
+ bool &var_;
};
//------------------------------------------------------------------------
class DateTimeSetting: public VarSetting
{
public:
- DateTimeSetting(const QString &name, QDateTime &var):VarSetting(), name(name), var(var) { }
- void saveSetting(QSettings &st) {st.setValue(name, var); }
- void restoreSetting(QSettings &st) {if (st.contains(name)) var = st.value(name).toDateTime(); }
+ DateTimeSetting(const QString &name, QDateTime &var):VarSetting(), name_(name), var_(var) { }
+ void saveSetting(QSettings &st) {st.setValue(name_, var_); }
+ void restoreSetting(QSettings &st) {if (st.contains(name_)) var_ = st.value(name_).toDateTime(); }
private:
- QString name;
- QDateTime &var;
+ QString name_;
+ QDateTime &var_;
};
public:
SettingGroup() {}
~SettingGroup() {
- for (int i=0; i<group.size(); i++)
- delete group[i];
+ for (int i=0; i< settingGroup_.size(); i++)
+ delete settingGroup_[i];
}
void saveSettings(QSettings &st) {
- for (int i=0; i<group.size(); i++)
- group[i]->saveSetting(st);
+ for (int i=0; i< settingGroup_.size(); i++)
+ settingGroup_[i]->saveSetting(st);
}
void restoreSettings(QSettings &st) {
- for (int i=0; i<group.size(); i++)
- group[i]->restoreSetting(st);
+ for (int i=0; i< settingGroup_.size(); i++)
+ settingGroup_[i]->restoreSetting(st);
}
void addVarSetting(VarSetting *vs) {
- group << vs;
+ settingGroup_ << vs;
}
private:
- QList <VarSetting *> group;
+ QList <VarSetting *> settingGroup_;
};
#endif
UpgradeCheck::UpgradeCheck(QWidget *parent, QList<Format> &formatList,
BabelData& bd) :
QObject(parent),
- manager(0),
- replyId(0),
- upgradeUrl(QUrl("http://www.gpsbabel.org/upgrade_check.html")),
+ manager_(0),
+ replyId_(0),
+ upgradeUrl_(QUrl("http://www.gpsbabel.org/upgrade_check.html")),
formatList_(formatList),
updateStatus_(updateUnknown),
- bd_(bd)
+ babelData_(bd)
{
}
UpgradeCheck::~UpgradeCheck()
{
- if (replyId) {
- replyId->abort();
- replyId = 0;
+ if (replyId_) {
+ replyId_->abort();
+ replyId_ = 0;
}
- if (manager) {
- delete manager;
- manager = 0;
+ if (manager_) {
+ delete manager_;
+ manager_ = 0;
}
}
const QDateTime &lastCheckTime,
bool allowBeta)
{
- currentVersion = currentVersionIn;
- currentVersion.remove("GPSBabel Version ");
+ currentVersion_ = currentVersionIn;
+ currentVersion_.remove("GPSBabel Version ");
QDateTime soonestCheckTime = lastCheckTime.addDays(1);
if (!testing && QDateTime::currentDateTime() < soonestCheckTime) {
return UpgradeCheck::updateUnknown;
}
- manager = new QNetworkAccessManager;
+ manager_ = new QNetworkAccessManager;
- connect(manager, SIGNAL(finished(QNetworkReply*)),
+ connect(manager_, SIGNAL(finished(QNetworkReply*)),
this, SLOT(httpRequestFinished(QNetworkReply*)));
- QNetworkRequest request = QNetworkRequest(upgradeUrl);
+ QNetworkRequest request = QNetworkRequest(upgradeUrl_);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
request.setRawHeader("Accept-Encoding","identity");
QLocale locale;
- QString args = "current_version=" + currentVersion;
+ QString args = "current_version=" + currentVersion_;
args += "¤t_gui_version=" VERSION;
- args += "&installation=" + bd_.installationUuid;
+ args += "&installation=" + babelData_.installationUuid_;
args += "&os=" + getOsName();
#if HAVE_UNAME
struct utsname utsname;
args += QString("&beta_ok=%1").arg(allowBeta);
args += "&lang=" + QLocale::languageToString(locale.language());
args += "&last_checkin=" + lastCheckTime.toString(Qt::ISODate);
- args += QString("&ugcb=%1").arg(bd_.upgradeCallbacks);
- args += QString("&ugdec=%1").arg(bd_.upgradeDeclines);
- args += QString("&ugacc=%1").arg(bd_.upgradeAccept);
- args += QString("&ugoff=%1").arg(bd_.upgradeOffers);
- args += QString("&ugerr=%1").arg(bd_.upgradeErrors);
- args += QString("&rc=%1").arg(bd_.runCount);
+ args += QString("&ugcb=%1").arg(babelData_.upgradeCallbacks_);
+ args += QString("&ugdec=%1").arg(babelData_.upgradeDeclines_);
+ args += QString("&ugacc=%1").arg(babelData_.upgradeAccept_);
+ args += QString("&ugoff=%1").arg(babelData_.upgradeOffers_);
+ args += QString("&ugerr=%1").arg(babelData_.upgradeErrors_);
+ args += QString("&rc=%1").arg(babelData_.runCount_);
int j = 0;
if (wc)
args += QString("&uc%1=wr/%2/%3").arg(j++).arg(formatName).arg(wc);
}
- if (j && bd_.reportStatistics)
+ if (j && babelData_.reportStatistics_)
args += QString("&uc=%1").arg(j);
if (false && testing) {
qDebug() << "Posting " << args;
}
- replyId = manager->post(request, args.toUtf8());
+ replyId_ = manager_->post(request, args.toUtf8());
return UpgradeCheck::updateUnknown;
}
QDateTime UpgradeCheck::getUpgradeWarningTime() {
- return upgradeWarningTime;
+ return upgradeWarningTime_;
}
UpgradeCheck::updateStatus UpgradeCheck::getStatus() {
{
if (reply == 0 ) {
- bd_.upgradeErrors++;
+ babelData_.upgradeErrors_++;
return;
- } else if (reply != replyId) {
+ } else if (reply != replyId_) {
QMessageBox::information(0, tr("HTTP"),
tr("Unexpected reply."));
} else if (reply->error() != QNetworkReply::NoError ) {
- bd_.upgradeErrors++;
+ babelData_.upgradeErrors_++;
QMessageBox::information(0, tr("HTTP"),
tr("Download failed: %1.")
.arg(reply->errorString()));
- replyId = 0;
+ replyId_ = 0;
reply->deleteLater();
return;
}
}
// Change the url for the next update check.
// TOODO: kick off another update check.
- upgradeUrl = redirectUrl;
- replyId = 0;
+ upgradeUrl_ = redirectUrl;
+ replyId_ = 0;
reply->deleteLater();
return;
}
tr("Download failed: %1: %2.")
.arg(statusCode.toInt())
.arg(reason.toString()));
- replyId = 0;
+ replyId_ = 0;
reply->deleteLater();
return;
}
- bd_.upgradeCallbacks++;
+ babelData_.upgradeCallbacks_++;
QString oresponse(reply->readAll());
QDomDocument document;
tr("Invalid return data at line %1: %2.")
.arg(line)
.arg( error_text));
- bd_.upgradeErrors++;
- replyId = 0;
+ babelData_.upgradeErrors_++;
+ replyId_ = 0;
reply->deleteLater();
return;
}
QString upgradeText;
if (testing)
- currentVersion = "1.3.1"; // for testing
+ currentVersion_ = "1.3.1"; // for testing
bool allowBeta = true; // TODO: come from prefs or current version...
upgradeText = upgrade.firstChildElement("overview").text();
// String compare, not a numeric one. Server will return "best first".
- if((updateVersion > currentVersion) && updateCandidate) {
- bd_.upgradeOffers++;
+ if((updateVersion > currentVersion_) && updateCandidate) {
+ babelData_.upgradeOffers_++;
updateStatus_ = updateNeeded;
response = tr("A new version of GPSBabel is available.<br />"
"Your version is %1 <br />"
"The latest version is %2")
- .arg(currentVersion)
+ .arg(currentVersion_)
.arg(updateVersion);
break;
}
case QMessageBox::Yes:
// downloadUrl.addQueryItem("os", getOsName());
QDesktopServices::openUrl(downloadUrl);
- bd_.upgradeAccept++;
+ babelData_.upgradeAccept_++;
break;
default: ;
- bd_.upgradeDeclines++;
+ babelData_.upgradeDeclines_++;
}
}
- upgradeWarningTime = QDateTime(QDateTime::currentDateTime());
+ upgradeWarningTime_ = QDateTime(QDateTime::currentDateTime());
for (int i = 0; i < formatList_.size(); i++) {
formatList_[i].zeroUseCounts();
}
- replyId = 0;
+ replyId_ = 0;
reply->deleteLater();
}
protected:
private:
- QString currentVersion;
- int upgradeCheckMethod;
- QNetworkAccessManager* manager;
- QNetworkReply* replyId;
- QUrl upgradeUrl;
- bool httpRequestAborted;
- QString latestVersion;
- QDateTime upgradeWarningTime; // invalid time if this object never issued.
+ QString currentVersion_;
+ int upgradeCheckMethod_;
+ QNetworkAccessManager* manager_;
+ QNetworkReply* replyId_;
+ QUrl upgradeUrl_;
+ bool httpRequestAborted_;
+ QString latestVersion_;
+ QDateTime upgradeWarningTime_; // invalid time if this object never issued.
QList<Format> &formatList_;
updateStatus updateStatus_;
- BabelData& bd_;
+ BabelData& babelData_;
QString getOsName(void);
QString getOsVersion(void);
VersionMismatch::VersionMismatch(QWidget *parent, const QString &ver1,
const QString &ver2): QDialog(parent)
{
- ui.setupUi(this);
+ ui_.setupUi(this);
- ui.ClVersion->setText(ver1);
- ui.ClVersion->adjustSize();
+ ui_.ClVersion->setText(ver1);
+ ui_.ClVersion->adjustSize();
- ui.GuiVersion->setText(ver2);
- ui.GuiVersion->adjustSize();
+ ui_.GuiVersion->setText(ver2);
+ ui_.GuiVersion->adjustSize();
}
public:
VersionMismatch(QWidget *parent, const QString &ver1,
const QString &ver2);
- bool neverAgain() { return ui.neverAgain->isChecked(); }
+ bool neverAgain() { return ui_.neverAgain->isChecked(); }
private:
- Ui_VersionMismatch ui;
+ Ui_VersionMismatch ui_;
};
#endif